From f74b2aa7770a4c78ac7cb13fe2015f23ed9c597c Mon Sep 17 00:00:00 2001 From: Schweber <64630479+Schweber@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:07:00 +0000 Subject: [PATCH] nix activation-script: add handling of empty input (#945) Fixed the check for empty input. Should be working correctly now. --- modules/nix/activation-script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nix/activation-script b/modules/nix/activation-script index 43842a2..06cc2ba 100644 --- a/modules/nix/activation-script +++ b/modules/nix/activation-script @@ -4,7 +4,7 @@ nix.settings.experimental-features = ["nix-command"]; system.activationScripts.diff = '' if [[ -e /run/current-system ]]; then - ${pkgs.nushell}/bin/nu -c "let diff_closure = ${pkgs.nix}/bin/nix store diff-closures /run/current-system '$systemConfig'; if (\$diff_closure | is-not-empty) { let table = \$diff_closure | lines | where \$it =~ KiB | where \$it =~ → | parse -r '^(?\S+): (?[^,]+)(?:.*) → (?[^,]+)(?:.*), (?.*)$' | insert Diff { get DiffBin | ansi strip | into filesize } | sort-by -r Diff | reject DiffBin; print \"\"; \$table | append [[Package Old New Diff]; [\"\" \"\" \"\" \"\"]] | append [[Package Old New Diff]; [\"\" \"\" \"Total:\" (\$table | get Diff | math sum)]] | print; print \"\" }" + ${pkgs.nushell}/bin/nu -c "let diff_closure = (${pkgs.nix}/bin/nix store diff-closures /run/current-system '$systemConfig'); let table = (\$diff_closure | lines | where \$it =~ KiB | where \$it =~ → | parse -r '^(?\S+): (?[^,]+)(?:.*) → (?[^,]+)(?:.*), (?.*)$' | insert Diff { get DiffBin | ansi strip | into filesize } | sort-by -r Diff | reject DiffBin); if (\$table | get Diff | is-not-empty) { print \"\"; \$table | append [[Package Old New Diff]; [\"\" \"\" \"\" \"\"]] | append [[Package Old New Diff]; [\"\" \"\" \"Total:\" (\$table | get Diff | math sum) ]] | print; print \"\" }" fi '';