From ab4a5cb0c6c713d5e3a98f3e21eb8a2bb759653d Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 8 Aug 2023 09:10:49 -0400 Subject: pkgs: make nixgc an actual package --- pkgs/nixgc.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pkgs/nixgc.nix (limited to 'pkgs/nixgc.nix') 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; +} -- cgit v1.2.3