home-manager/tests/modules/services/nix-gc/basic.nix
Ninja3047 db40fead89
nix-gc: call nix-collect-garbage in a shell script
This will match the behavior in the upstream service which allows the
user to set options to something that uses shell syntax.
2024-07-30 07:54:18 +02:00

29 lines
621 B
Nix

{ ... }:
{
nix.gc = {
automatic = true;
frequency = "monthly";
options = "--delete-older-than 30d --max-freed $((64 * 1024**3))";
};
test.stubs.nix = { name = "nix"; };
nmt.script = ''
serviceFile=home-files/.config/systemd/user/nix-gc.service
assertFileExists $serviceFile
serviceFile=$(normalizeStorePaths $serviceFile)
assertFileContent $serviceFile ${./expected.service}
timerFile=home-files/.config/systemd/user/nix-gc.timer
assertFileExists $timerFile
timerFile=$(normalizeStorePaths $timerFile)
assertFileContent $timerFile ${./expected.timer}
'';
}