diff --git a/bin/hey b/bin/hey index 20a0080d..a0961c16 100755 --- a/bin/hey +++ b/bin/hey @@ -218,10 +218,6 @@ module Hey opts "-a", "--all", "GC both the user and system profiles" opts "-s", "--system", "Only GC the system profile" lambda do |_args| - if @@opts[:all] or not @@opts[:system] - puts "Cleaning up your user profile..." - sh %w{nix-collect-garbage -d} - end if @@opts[:all] or @@opts[:system] puts "Cleaning up your system profile..." sh %w{nix-collect-garbage -d}, sudo: true @@ -238,6 +234,10 @@ module Hey sh %w{nix-env --delete-generations old --profile /nix/var/nix/profiles/system}, sudo: true sh %w{/nix/var/nix/profiles/system/bin/switch-to-configuration switch}, sudo: true end + if @@opts[:all] or not @@opts[:system] + puts "Cleaning up your user profile..." + sh %w{nix-collect-garbage -d} + end end end