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-unstable.url = "github:/NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; 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"; impermanence.url = "github:nix-community/impermanence";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
mailserver.url = "gitlab:/simple-nixos-mailserver/nixos-mailserver"; mailserver.url = "gitlab:/simple-nixos-mailserver/nixos-mailserver";
@ -19,6 +27,7 @@
}; };
nvim-lazy = { nvim-lazy = {
url = "git+https://git.ophanim.de/derped/lazy.nvim.nix.git"; url = "git+https://git.ophanim.de/derped/lazy.nvim.nix.git";
# url = "git+file:///home/derped/Projects/nvim";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
@ -51,6 +60,10 @@
path = toString ./pkgs; path = toString ./pkgs;
fullPath = true; fullPath = true;
}; };
pkgsetFiles = fn.lst {
path = toString ./pkgsets;
fullPath = true;
};
serviceFiles = fn.lst { serviceFiles = fn.lst {
path = toString ./services; path = toString ./services;
fullPath = true; fullPath = true;
@ -85,6 +98,7 @@
++ machineFiles ++ machineFiles
++ configFiles ++ configFiles
++ pkgsFiles ++ pkgsFiles
++ pkgsetFiles
++ serviceFiles; ++ serviceFiles;
}; };
}; };

View file

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