1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-09-11 12:49:18 +03:00

nix-daemon: add tests

This commit is contained in:
Daiderd Jordan 2018-06-21 15:22:12 +02:00
parent 27a5758728
commit 9987c71c83
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
3 changed files with 46 additions and 0 deletions

View File

@ -100,6 +100,8 @@ let
tests.programs-zsh = makeTest ./tests/programs-zsh.nix;
tests.services-activate-system = makeTest ./tests/services-activate-system.nix;
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-ofborg = makeTest ./tests/services-ofborg.nix;
tests.services-offlineimap = makeTest ./tests/services-offlineimap.nix;
tests.services-skhd = makeTest ./tests/services-skhd.nix;

View File

@ -0,0 +1,24 @@
{ config, pkgs, ... }:
let
nix = pkgs.runCommand "nix-0.0.0" {} "mkdir -p $out";
in
{
services.nix-daemon.enable = true;
nix.package = nix;
test = ''
echo checking nix-daemon service in /Library/LaunchDaemons >&2
grep "<string>org.nixos.nix-daemon</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "<string>exec ${nix}/bin/nix-daemon</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
! grep "<key>Sockets</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
echo checking nix-daemon reload in /activate >&2
grep "pkill -HUP nix-daemon" ${config.out}/activate
echo checking NIX_REMOTE=daemon in /etc/bashrc >&2
grep "NIX_REMOTE=daemon" ${config.out}/etc/bashrc
'';
}

View File

@ -0,0 +1,20 @@
{ config, pkgs, ... }:
let
nix = pkgs.runCommand "nix-0.0.0" {} "mkdir -p $out";
in
{
services.nix-daemon.enable = true;
services.nix-daemon.enableSocketListener = true;
nix.package = nix;
test = ''
echo checking nix-daemon service in /Library/LaunchDaemons >&2
grep "<string>org.nixos.nix-daemon</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "<string>exec ${nix}/bin/nix-daemon</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
! grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "<key>Sockets</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
grep "/nix/var/nix/daemon-socket/socket" ${config.out}/Library/LaunchDaemons/org.nixos.nix-daemon.plist
'';
}