refactor: pkgs

This commit is contained in:
2025-12-27 14:34:50 +08:00
parent e112f5f21d
commit 4ab322f08d
5 changed files with 25 additions and 40 deletions

View File

@@ -114,8 +114,8 @@
imports = [
./flake/hosts.nix
./flake/pkgs.nix
./treefmt.nix
./pkgs
./overlays
];

View File

@@ -10,9 +10,7 @@
let
vars = import ../vars.nix;
pkgsModule = {
nixpkgs = pkgsParams // {
inherit (config.nixpkgs.hostPlatform) system;
};
nixpkgs = pkgsParams;
};
hmModule = {
home-manager = {

View File

@@ -24,19 +24,16 @@
flake.setNixPath = false;
};
};
perSystem =
{
system,
pkgs,
...
}:
let
in
{
_module.args.pkgs = import inputs.nixpkgs (pkgsParams // { inherit system; });
legacyPackages = pkgs;
packages = lib.genAttrs (builtins.attrNames (config.flake.overlays.additions pkgs pkgs)) (
pkg: pkgs.${pkg}
);
@@ -44,21 +41,15 @@
flake.overlays.additions =
final: prev:
let
paths = [
# keep-sorted start
./fcitx5-lightly
./jj-starship.nix
./mono-gtk-theme.nix
./ttf-wps-fonts.nix
./wps-office-fonts.nix
# keep-sorted end
];
in
builtins.listToAttrs (
map (path: {
name = builtins.elemAt (lib.splitString "." (builtins.baseNameOf path)) 0;
value = final.callPackage path { };
}) paths
);
with lib.haumea;
load {
src = ../pkgs;
loader = [
{
matches = str: builtins.match ".*\\.nix" str != null;
loader = _: path: final.callPackage path { };
}
];
transformer = transformers.liftDefault;
};
}

View File

@@ -28,9 +28,7 @@ let
|| extraExcludePredicate path;
in
unique (
(filter
(file: pathIsRegularFile file && hasSuffix ".nix" (builtins.toString file) && !isExcluded file)
(
(filter (file: pathIsRegularFile file && hasSuffix ".nix" (toString file) && !isExcluded file) (
concatMap (
path:
if recursive then
@@ -40,8 +38,7 @@ let
name: type: path + (if type == "directory" then "/${name}/default.nix" else "/${name}")
) (builtins.readDir path)
) (unique (if path == null then paths else [ path ] ++ paths))
)
)
))
++ (if recursive then concatMap (path: toList path) (unique include) else unique include)
);
in

View File

@@ -38,8 +38,7 @@ in
}) config.nix.registry;
nix.settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
experimental-features = "nix-command flakes pipe-operators";
substituters = [
"https://mirrors.sjtug.sjtu.edu.cn/nix-channels/store"
"https://mirror.sjtu.edu.cn/nix-channels/store"