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 2a49bbe041
Signed by: derped
GPG key ID: C0F1D326C7626543
2 changed files with 15 additions and 10 deletions

View file

@ -6,6 +6,14 @@
nixpkgs-unstable.url = "github:/NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
catppuccin = {
url = "github:catppuccin/nix";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
flake-utils.url = "github:numtide/flake-utils";
mailserver.url = "gitlab:/simple-nixos-mailserver/nixos-mailserver";
@ -19,6 +27,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 +60,10 @@
path = toString ./pkgs;
fullPath = true;
};
pkgsetFiles = fn.lst {
path = toString ./pkgsets;
fullPath = true;
};
serviceFiles = fn.lst {
path = toString ./services;
fullPath = true;
@ -85,6 +98,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
);
}