diff options
author | ene <ene@sils.li> | 2023-02-01 22:23:43 +0100 |
---|---|---|
committer | ene <ene@sils.li> | 2023-02-03 17:34:46 +0100 |
commit | d30db6253ca13316057397e8b1bd106bac0af523 (patch) | |
tree | 3c1a21eaf9cc930e08ddf584aab7d07826b4f105 /system | |
parent | Feat: Split the config apart (diff) | |
download | nixos-config-d30db6253ca13316057397e8b1bd106bac0af523.tar.gz nixos-config-d30db6253ca13316057397e8b1bd106bac0af523.zip |
Refactor(packages): Refactored Packages
Diffstat (limited to 'system')
-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 |