diff options
-rw-r--r-- | system/packages/packages.nix | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/system/packages/packages.nix b/system/packages/packages.nix index 1acba85e..c9ac9431 100644 --- a/system/packages/packages.nix +++ b/system/packages/packages.nix @@ -2,9 +2,41 @@ config, pkgs, ... -}: { +}: let + output = + pkgs.runCommand + "packages-cleaner" + {} + '' + mkdir $out + echo '[' >> $out/clean.json + awk '{ + if (NF) { + gsub(/^[[:blank:]]*/,"") + gsub(/[[:blank:]]*$/,"") + if ( !/^#/ || !/^\/\// ) { + if ( /.*#/ && !/#!/ ) { + gsub(/#.*/,"") + gsub(/[[:blank:]]*$/,"") + if (NF) { + print "pkgs.%s" $0 + } + } else { + print "pkgs.%s" $0 + } + } + + } + }' "./packages.conf" >> $out/clean.json + echo ']' >> $out/clean.json + + + ''; + + packagesList = builtins.fromJSON "${output}/clean.json"; # TODO could work +in { environment.systemPackages = with pkgs; [ - (builtins.readFile ./packages.conf) # TODO could work + packagesList ]; } # QEMU |