Add cleanup_temporary_files script to base.

This commit is contained in:
Tom Alexander 2025-10-25 15:04:14 -04:00
parent 381eb1523e
commit 4a0f0bd8c8
Signed by: talexander
GPG Key ID: 36C99E8B3C39D85F
2 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,16 @@
...
}:
let
patchScriptBin =
filename: contents:
((pkgs.writeScriptBin filename contents).overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
}));
cleanup_temporary_files = (
patchScriptBin "cleanup_temporary_files" (builtins.readFile ./files/cleanup_temporary_files.bash)
);
in
{
imports = [ ];
@ -45,6 +55,7 @@
gptfdisk # for cgdisk
nix-output-monitor # For better view into nixos-rebuild
nix-serve-ng # Serve nix store over http
cleanup_temporary_files
];
};
}

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
#
# Delete temporary files on entire disk
find / -type f '(' -name '*.orig' -or -name '*~' -or -name '*.core' ')' -delete -print 2>/dev/null