systemPackages: refactor/simplify pkgset import and resolution

This commit is contained in:
Kevin Baensch 2025-07-10 22:00:31 +02:00
parent 94b10b47b1
commit 1fe3f04e12
Signed by: derped
GPG key ID: C0F1D326C7626543
2 changed files with 7 additions and 10 deletions

View file

@ -19,6 +19,7 @@
};
nvim-lazy = {
url = "git+https://git.ophanim.de/derped/lazy.nvim.nix.git";
# url = "git+file:///home/derped/Projects/nvim";
inputs.nixpkgs.follows = "nixpkgs";
};
};
@ -51,6 +52,10 @@
path = toString ./pkgs;
fullPath = true;
};
pkgsetFiles = fn.lst {
path = toString ./pkgsets;
fullPath = true;
};
serviceFiles = fn.lst {
path = toString ./services;
fullPath = true;
@ -85,6 +90,7 @@
++ machineFiles
++ configFiles
++ pkgsFiles
++ pkgsetFiles
++ serviceFiles;
};
};

View file

@ -1,23 +1,14 @@
{
config,
lib,
fn,
...
}:
with lib;
let
cfg = config.machine;
pkgsets = fn.lst {
path = toString ../pkgsets;
fullPath = true;
};
in
{
imports = pkgsets;
environment.systemPackages = flatten (
lists.forEach (attrVals (filter (v: !(strings.hasInfix "::" v)) cfg.pkgs) cfg.pkgsets) (
v: v.pkgwrap
)
map (setName: lib.optionals (cfg.pkgsets ? "${setName}") cfg.pkgsets."${setName}".pkgwrap) cfg.pkgs
);
}