mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-28 02:37:09 +00:00
checks: add test for nix-gc user validation
This commit is contained in:
parent
458d09882e
commit
462ec30cb3
3 changed files with 25 additions and 1 deletions
|
@ -90,6 +90,7 @@ let
|
|||
examples.simple = genExample ./modules/examples/simple.nix;
|
||||
|
||||
tests.activation-scripts = makeTest ./tests/activation-scripts.nix;
|
||||
tests.checks-nix-gc = makeTest ./tests/checks-nix-gc.nix;
|
||||
tests.environment-path = makeTest ./tests/environment-path.nix;
|
||||
tests.launchd-setenv = makeTest ./tests/launchd-setenv.nix;
|
||||
tests.networking-hostname = makeTest ./tests/networking-hostname.nix;
|
||||
|
|
19
tests/checks-nix-gc.nix
Normal file
19
tests/checks-nix-gc.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
nix = pkgs.runCommand "nix-0.0.0" {} "mkdir -p $out";
|
||||
in
|
||||
|
||||
{
|
||||
nix.gc.automatic = true;
|
||||
nix.package = nix;
|
||||
|
||||
test = ''
|
||||
echo checking nix-gc validation >&2
|
||||
grep "nix.gc.user = " ${config.out}/activate-user
|
||||
|
||||
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 "<key>UserName</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-gc.plist
|
||||
'';
|
||||
}
|
|
@ -15,7 +15,11 @@ in
|
|||
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 "<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
|
||||
|
||||
echo checking nix-gc validation >&2
|
||||
! grep "nix.gc.user = " ${config.out}/activate-user
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue