diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2019-01-03 20:58:57 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2019-01-03 20:59:23 +0100 |
| commit | f05d6a858f26aec0e29612dfc1cb965c0cc9599b (patch) | |
| tree | a097730d85b4fd5e4199a61eab427cbb349c5307 /tests | |
| parent | 28710738a3ca7c9a16d63b89c904588d030edf01 (diff) | |
nix-gc: add test
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/services-nix-gc.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/services-nix-gc.nix b/tests/services-nix-gc.nix new file mode 100644 index 0000000..19bb7b6 --- /dev/null +++ b/tests/services-nix-gc.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: + +let + nix = pkgs.runCommand "nix-0.0.0" {} "mkdir -p $out"; +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 + grep "<string>exec ${nix}/bin/nix-collect-garbage --delete-older-than 30d</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist + grep "<key>UserName</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist + grep "<string>nixuser</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist + ! grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist + ''; +} |
