From d30db6253ca13316057397e8b1bd106bac0af523 Mon Sep 17 00:00:00 2001 From: ene Date: Wed, 1 Feb 2023 22:23:43 +0100 Subject: Refactor(packages): Refactored Packages --- system/packages/packages.nix | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'system/packages/packages.nix') 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 -- cgit 1.4.1