From 2a49bbe041a751d87ed3187ce7c01600746f39fe Mon Sep 17 00:00:00 2001 From: derped Date: Thu, 10 Jul 2025 22:00:31 +0200 Subject: [PATCH] systemPackages: refactor/simplify pkgset import and resolution --- flake.nix | 14 ++++++++++++++ pkgs/systemPackages.nix | 11 +---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 3b2c55e..c0f0808 100644 --- a/flake.nix +++ b/flake.nix @@ -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; }; }; diff --git a/pkgs/systemPackages.nix b/pkgs/systemPackages.nix index 66df5fd..88afa8b 100644 --- a/pkgs/systemPackages.nix +++ b/pkgs/systemPackages.nix @@ -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 ); }