1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-28 02:37:09 +00:00

nix-gc: add test

This commit is contained in:
Daiderd Jordan 2019-01-03 20:58:57 +01:00
parent 28710738a3
commit f05d6a858f
No known key found for this signature in database
GPG key ID: D02435D05B810C96
2 changed files with 22 additions and 0 deletions

View file

@ -101,6 +101,7 @@ let
tests.services-buildkite-agent = makeTest ./tests/services-buildkite-agent.nix;
tests.services-nix-daemon = makeTest ./tests/services-nix-daemon.nix;
tests.sockets-nix-daemon = makeTest ./tests/sockets-nix-daemon.nix;
tests.services-nix-gc = makeTest ./tests/services-nix-gc.nix;
tests.services-ofborg = makeTest ./tests/services-ofborg.nix;
tests.services-offlineimap = makeTest ./tests/services-offlineimap.nix;
tests.services-skhd = makeTest ./tests/services-skhd.nix;

21
tests/services-nix-gc.nix Normal file
View file

@ -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
'';
}