summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2019-01-03 20:58:57 +0100
committerDaiderd Jordan <daiderd@gmail.com>2019-01-03 20:59:23 +0100
commitf05d6a858f26aec0e29612dfc1cb965c0cc9599b (patch)
treea097730d85b4fd5e4199a61eab427cbb349c5307 /tests
parent28710738a3ca7c9a16d63b89c904588d030edf01 (diff)
nix-gc: add test
Diffstat (limited to 'tests')
-rw-r--r--tests/services-nix-gc.nix21
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
+ '';
+}