From b0098f1c8e05251695ec63707067dc0be321bd6b Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sat, 20 May 2023 21:09:22 +0100 Subject: [PATCH] move min-list-garbage into min-collect-garbage pkg we don't want it in the same package as min-copy-closure as that depends on bash --- pkgs/default.nix | 1 + pkgs/min-collect-garbage/default.nix | 17 +++++++++++++++++ pkgs/min-collect-garbage/min-collect-garbage.sh | 3 +++ .../min-list-garbage.c | 1 - pkgs/min-copy-closure/default.nix | 2 -- 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 pkgs/min-collect-garbage/default.nix create mode 100755 pkgs/min-collect-garbage/min-collect-garbage.sh rename pkgs/{min-copy-closure => min-collect-garbage}/min-list-garbage.c (96%) diff --git a/pkgs/default.nix b/pkgs/default.nix index 7e4feb4..61ae3e2 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -46,6 +46,7 @@ openwrt = callPackage ./openwrt {}; initramfs-peek = callPackage ./initramfs-peek {}; + min-collect-garbage = callPackage ./min-collect-garbage {}; min-copy-closure = callPackage ./min-copy-closure {}; hi = callPackage ./hi {}; } diff --git a/pkgs/min-collect-garbage/default.nix b/pkgs/min-collect-garbage/default.nix new file mode 100644 index 0000000..3caf62d --- /dev/null +++ b/pkgs/min-collect-garbage/default.nix @@ -0,0 +1,17 @@ +{ + stdenv +, nix +, cpio +, openssh +}: stdenv.mkDerivation { + name = "min-collect-garbage"; + buildInputs = [ ]; +# propagatedBuildInputs = [ openssh ]; + src = ./.; + makeFlags = [ "min-list-garbage" ]; + installPhase = '' + mkdir -p $out/bin + cp min-collect-garbage.sh $out/bin/min-collect-garbage + cp min-list-garbage $out/bin + ''; +} diff --git a/pkgs/min-collect-garbage/min-collect-garbage.sh b/pkgs/min-collect-garbage/min-collect-garbage.sh new file mode 100755 index 0000000..723bda3 --- /dev/null +++ b/pkgs/min-collect-garbage/min-collect-garbage.sh @@ -0,0 +1,3 @@ +#!/bin/sh +test -f /persist/nix-store-paths || exit 1 +(cd /nix/store && min-list-garbage /persist/nix-store-paths | xargs rm -r) diff --git a/pkgs/min-copy-closure/min-list-garbage.c b/pkgs/min-collect-garbage/min-list-garbage.c similarity index 96% rename from pkgs/min-copy-closure/min-list-garbage.c rename to pkgs/min-collect-garbage/min-list-garbage.c index a260a8b..7b4668a 100644 --- a/pkgs/min-copy-closure/min-list-garbage.c +++ b/pkgs/min-collect-garbage/min-list-garbage.c @@ -19,7 +19,6 @@ int add_list_entry(char *name) hash_list = realloc(hash_list, hash_list_size * sizeof(hash_t)); } strncpy(hash_list[hash_list_entries++], name, 32); - printf("%d %d\n", hash_list_entries, hash_list_size); } int read_list(char *filename) diff --git a/pkgs/min-copy-closure/default.nix b/pkgs/min-copy-closure/default.nix index 1e07897..ce06dba 100644 --- a/pkgs/min-copy-closure/default.nix +++ b/pkgs/min-copy-closure/default.nix @@ -8,13 +8,11 @@ buildInputs = [ ]; propagatedBuildInputs = [ cpio openssh nix ]; src = ./.; - makeFlags = [ "min-list-garbage" ]; installPhase = '' mkdir -p $out/bin for i in min-copy-closure liminix-rebuild; do echo $i cp ''${i}.sh $out/bin/$i done - cp min-list-garbage $out/bin ''; }