2019-01-03 19:58:57 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2024-08-31 08:27:10 +00:00
|
|
|
nix = pkgs.runCommand "nix-2.2" { } "mkdir -p $out";
|
2019-01-03 19:58:57 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
nix.gc.automatic = true;
|
|
|
|
nix.gc.options = "--delete-older-than 30d";
|
|
|
|
nix.gc.user = "nixuser";
|
|
|
|
nix.package = nix;
|
|
|
|
|
|
|
|
test = ''
|
|
|
|
echo checking nix-gc service in /Library/LaunchDaemons >&2
|
|
|
|
grep "<string>org.nixos.nix-gc</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
|
2024-08-31 08:27:10 +00:00
|
|
|
grep "<string>/bin/wait4path /nix/store && exec ${nix}/bin/nix-collect-garbage --delete-older-than 30d</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
|
2019-01-03 19:58:57 +00:00
|
|
|
grep "<key>UserName</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
|
2023-08-03 08:47:58 +00:00
|
|
|
grep "<string>nixuser</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
|
2019-01-03 23:50:14 +00:00
|
|
|
|
2023-08-03 08:47:58 +00:00
|
|
|
(! grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist)
|
2019-01-03 23:50:14 +00:00
|
|
|
|
|
|
|
echo checking nix-gc validation >&2
|
2023-08-03 08:47:58 +00:00
|
|
|
(! grep "nix.gc.user = " ${config.out}/activate-user)
|
2019-01-03 19:58:57 +00:00
|
|
|
'';
|
|
|
|
}
|