diff options
| author | seth <[email protected]> | 2023-08-08 09:10:49 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-08-08 09:10:49 -0400 |
| commit | ab4a5cb0c6c713d5e3a98f3e21eb8a2bb759653d (patch) | |
| tree | 2cb928422ed95b9ea389989c5a6ad4d199bc8ff7 /pkgs/nixgc.nix | |
| parent | a0229f519b150e51d8994c98b639c4df45d82d6f (diff) | |
pkgs: make nixgc an actual package
Diffstat (limited to 'pkgs/nixgc.nix')
| -rw-r--r-- | pkgs/nixgc.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/nixgc.nix b/pkgs/nixgc.nix new file mode 100644 index 0000000..d13614a --- /dev/null +++ b/pkgs/nixgc.nix @@ -0,0 +1,22 @@ +# this is a shell script that uses the new nix cli to emulate +# nix-collect-garbage +{ + lib, + writeShellApplication, + nix, + fd, +}: +writeShellApplication { + name = "nixgc"; + + runtimeInputs = [nix fd]; + + text = '' + fd . /nix/var/nix/profiles /home/*/.local/state/nix/profiles -d 3 -t symlink -E '*-link' | while read -r profile; do + nix profile wipe-history --profile "$profile" "$@" + done + ''; +} +// { + meta.platforms = lib.platforms.linux; +} |
