From 493ce41772ee466930f3ecff8bd7608869c0432e Mon Sep 17 00:00:00 2001 From: Lin Yinfeng Date: Thu, 4 Dec 2025 20:47:12 +0800 Subject: [PATCH 1/2] angrr: 0.1.3 -> 0.1.5 --- pkgs/by-name/an/angrr/package.nix | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/an/angrr/package.nix b/pkgs/by-name/an/angrr/package.nix index 48e150b19463..36ec20e30d36 100644 --- a/pkgs/by-name/an/angrr/package.nix +++ b/pkgs/by-name/an/angrr/package.nix @@ -11,26 +11,32 @@ rustPlatform.buildRustPackage (finalAttrs: { pname = "angrr"; - version = "0.1.3"; + version = "0.1.5"; src = fetchFromGitHub { owner = "linyinfeng"; repo = "angrr"; tag = "v${finalAttrs.version}"; - hash = "sha256-pBVbzrTy/IWIo6WlhM1qgowfxSU31awyHcRDHNArBMo="; + hash = "sha256-PT3oCNPRvEroyVNiICeO0hSHDzKUC6KcP9HnIw1kMQE="; }; - cargoHash = "sha256-DoQIJCs36ZmTxdsDCzquKAeOSIUBbo2V+DTx68FZiu4="; + cargoHash = "sha256-lDOH4Ceap69fX6VWbgQoQfmYWZI+jPE0LJiXmqrTRn8="; + + buildAndTestSubdir = "angrr"; nativeBuildInputs = [ installShellFiles ]; + postBuild = '' + mkdir --parents build/{man-pages,shell-completions} + cargo xtask man-pages --out build/man-pages + cargo xtask shell-completions --out build/shell-completions + ''; postInstall = '' install -m400 -D ./direnv/angrr.sh $out/share/direnv/lib/angrr.sh - '' - + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installManPage build/man-pages/* installShellCompletion --cmd angrr \ - --bash <($out/bin/angrr completion bash) \ - --fish <($out/bin/angrr completion fish) \ - --zsh <($out/bin/angrr completion zsh) + --bash build/shell-completions/angrr.bash \ + --fish build/shell-completions/angrr.fish \ + --zsh build/shell-completions/_angrr ''; passthru = { @@ -44,7 +50,7 @@ rustPlatform.buildRustPackage (finalAttrs: { }; meta = { - description = "Tool for auto Nix GC roots retention"; + description = "Temporary GC Roots Cleaner"; homepage = "https://github.com/linyinfeng/angrr"; license = [ lib.licenses.mit ]; maintainers = with lib.maintainers; [ yinfeng ]; From aecb34b42c8bfea097c3269b2b673e839ad8edd3 Mon Sep 17 00:00:00 2001 From: Lin Yinfeng Date: Sat, 6 Dec 2025 02:39:43 +0800 Subject: [PATCH 2/2] nixosTests.angrr: fix test 1. Starting from v0.1.4, the tool only monitors `result.*` and `.direnv/.*` GC roots. Modify paths to reflect this change. 2. `test ! -f /path/to/symlink` always succeed because symbol links are not regular file. Replace all `test ! -f` with `test ! -e`. --- nixos/tests/angrr.nix | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/nixos/tests/angrr.nix b/nixos/tests/angrr.nix index e4bca782a1ac..2c2baefd8e86 100644 --- a/nixos/tests/angrr.nix +++ b/nixos/tests/angrr.nix @@ -32,38 +32,38 @@ # Creates some auto gc roots # Use /run/current-system so that we do not need to build anything new - machine.succeed("nix build /run/current-system --out-link /tmp/root-auto-gc-root-1") - machine.succeed("nix build /run/current-system --out-link /tmp/root-auto-gc-root-2") - machine.succeed("su normal --command 'nix build /run/current-system --out-link /tmp/user-auto-gc-root-1'") - machine.succeed("su normal --command 'nix build /run/current-system --out-link /tmp/user-auto-gc-root-2'") + machine.succeed("nix build /run/current-system --out-link /tmp/result-root-auto-gc-root-1") + machine.succeed("nix build /run/current-system --out-link /tmp/result-root-auto-gc-root-2") + machine.succeed("su normal --command 'nix build /run/current-system --out-link /tmp/result-user-auto-gc-root-1'") + machine.succeed("su normal --command 'nix build /run/current-system --out-link /tmp/result-user-auto-gc-root-2'") machine.systemctl("start nix-gc.service") # Not auto gc root will be removed - machine.succeed("readlink /tmp/root-auto-gc-root-1") - machine.succeed("readlink /tmp/root-auto-gc-root-2") - machine.succeed("readlink /tmp/user-auto-gc-root-1") - machine.succeed("readlink /tmp/user-auto-gc-root-2") + machine.succeed("readlink /tmp/result-root-auto-gc-root-1") + machine.succeed("readlink /tmp/result-root-auto-gc-root-2") + machine.succeed("readlink /tmp/result-user-auto-gc-root-1") + machine.succeed("readlink /tmp/result-user-auto-gc-root-2") # Change time to 8 days after (greater than 7d) machine.succeed("date -s '8 days'") # Touch GC roots `-2` - machine.succeed("touch /tmp/root-auto-gc-root-2 --no-dereference") - machine.succeed("touch /tmp/user-auto-gc-root-2 --no-dereference") + machine.succeed("touch /tmp/result-root-auto-gc-root-2 --no-dereference") + machine.succeed("touch /tmp/result-user-auto-gc-root-2 --no-dereference") machine.systemctl("start nix-gc.service") # Only GC roots `-1` are removed - machine.succeed("test ! -f /tmp/root-auto-gc-root-1") - machine.succeed("readlink /tmp/root-auto-gc-root-2") - machine.succeed("test ! -f /tmp/user-auto-gc-root-1") - machine.succeed("readlink /tmp/user-auto-gc-root-2") + machine.succeed("test ! -e /tmp/result-root-auto-gc-root-1") + machine.succeed("readlink /tmp/result-root-auto-gc-root-2") + machine.succeed("test ! -e /tmp/result-user-auto-gc-root-1") + machine.succeed("readlink /tmp/result-user-auto-gc-root-2") # Change time again machine.succeed("date -s '8 days'") machine.systemctl("start nix-gc.service") # All auto GC roots are removed - machine.succeed("test ! -f /tmp/root-auto-gc-root-2") - machine.succeed("test ! -f /tmp/user-auto-gc-root-2") + machine.succeed("test ! -e /tmp/result-root-auto-gc-root-2") + machine.succeed("test ! -e /tmp/result-user-auto-gc-root-2") # Direnv integration test machine.succeed("mkdir /tmp/test-direnv") @@ -74,7 +74,7 @@ # The root will be removed if we does not use the direnv recently machine.succeed("date -s '8 days'") machine.systemctl("start nix-gc.service") - machine.succeed("test ! -f /tmp/test-direnv/.direnv/gc-root") + machine.succeed("test ! -e /tmp/test-direnv/.direnv/gc-root") # Recreate the root machine.succeed("nix build /run/current-system --out-link /tmp/test-direnv/.direnv/gc-root")