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 = [ imports = [
./flake/hosts.nix ./flake/hosts.nix
./flake/pkgs.nix
./treefmt.nix ./treefmt.nix
./pkgs
./overlays ./overlays
]; ];

View File

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

View File

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

View File

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

View File

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