angrr: 0.1.3 -> 0.1.5 (#467825)

This commit is contained in:
Aleksana
2025-12-06 14:17:21 +00:00
committed by GitHub
2 changed files with 32 additions and 26 deletions
+17 -17
View File
@@ -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")
+15 -9
View File
@@ -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 ];