mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-08-16 16:10:39 +03:00
ofborg: add basic test
This commit is contained in:
parent
2bcccfab29
commit
84a3fcadd0
@ -91,18 +91,18 @@ in
|
||||
|
||||
# FIXME: create logfiles automatically if defined.
|
||||
system.activationScripts.preActivation.text = ''
|
||||
mkdir -p "${user.home}"
|
||||
touch "${cfg.logFile}"
|
||||
chown ${toString user.uid}:${toString user.gid} "${user.home}" "${cfg.logFile}"
|
||||
mkdir -p '${user.home}'
|
||||
touch '${cfg.logFile}'
|
||||
chown ${toString user.uid}:${toString user.gid} '${user.home}' '${cfg.logFile}'
|
||||
'';
|
||||
|
||||
system.activationScripts.postActivation.text = ''
|
||||
if ! test -f "${cfg.configFile}"; then
|
||||
if ! test -f '${cfg.configFile}'; then
|
||||
echo >&2 "[1;31mwarning: ofborg config \"${cfg.configFile}\" does not exist[0m"
|
||||
fi
|
||||
|
||||
chmod 600 "${cfg.configFile}"
|
||||
chown ${toString user.uid}:${toString user.gid} "${cfg.configFile}"
|
||||
chmod 600 '${cfg.configFile}'
|
||||
chown ${toString user.uid}:${toString user.gid} '${cfg.configFile}'
|
||||
'';
|
||||
|
||||
};
|
||||
|
@ -99,6 +99,7 @@ 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-ofborg = makeTest ./tests/services-ofborg.nix;
|
||||
tests.services-skhd = makeTest ./tests/services-skhd.nix;
|
||||
tests.system-defaults-write = makeTest ./tests/system-defaults-write.nix;
|
||||
tests.system-keyboard-mapping = makeTest ./tests/system-keyboard-mapping.nix;
|
||||
|
30
tests/services-ofborg.nix
Normal file
30
tests/services-ofborg.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
ofborg = pkgs.runCommand "ofborg-0.0.0" {} "mkdir $out";
|
||||
in
|
||||
|
||||
{
|
||||
services.ofborg.enable = true;
|
||||
services.ofborg.package = ofborg;
|
||||
|
||||
users.knownGroups = [ "ofborg" ];
|
||||
users.knownUsers = [ "ofborg" ];
|
||||
|
||||
test = ''
|
||||
echo >&2 "checking ofborg service in /Library/LaunchDaemons"
|
||||
grep "org.nixos.ofborg" ${config.out}/Library/LaunchDaemons/org.nixos.ofborg.plist
|
||||
grep "<string>ofborg</string>" ${config.out}/Library/LaunchDaemons/org.nixos.ofborg.plist
|
||||
|
||||
echo >&2 "checking for user in /activate"
|
||||
grep "OfBorg service user" ${config.out}/activate
|
||||
|
||||
echo >&2 "checking for logfile permissions in /activate"
|
||||
grep "touch '/var/log/ofborg.log'" ${config.out}/activate
|
||||
grep "chown .* '/var/log/ofborg.log'" ${config.out}/activate
|
||||
|
||||
echo >&2 "checking config.json permissions in /activate"
|
||||
grep "chmod 600 '/var/lib/ofborg/config.json'" ${config.out}/activate
|
||||
grep "chown .* '/var/lib/ofborg/config.json'" ${config.out}/activate
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user