From 2a936b25d71986b1044645179b2fa385f43c2bc2 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 22 May 2024 04:06:24 -0400 Subject: treewide: enforce /package.nix --- pkgs/nixgc/package.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pkgs/nixgc/package.nix (limited to 'pkgs/nixgc/package.nix') diff --git a/pkgs/nixgc/package.nix b/pkgs/nixgc/package.nix new file mode 100644 index 0000000..9e25bd7 --- /dev/null +++ b/pkgs/nixgc/package.nix @@ -0,0 +1,25 @@ +# 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 = with lib; { + description = "nix-collect-garbage, but with nix profile"; + maintainers = [maintainers.getchoo]; + platforms = platforms.linux; + }; +} -- cgit v1.2.3