1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-31 04:04:45 +00:00
nix-darwin/tests/services-lorri.nix
Ihar Hrachyshka fc4e22f5d4 Use QueueDirectories to wait for /nix/store for keepalived services
This allows to get rid of wait4path and sh from the execution path for
the services. Which simplifies permissions configuration for nix-daemon,
among other things. (No longer needed to grant Full Disk Access / App
Management to /bin/sh for nix-daemon to deal with .app bundles.)

Related: https://github.com/NixOS/nix/issues/6765

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-03-14 22:48:32 -04:00

40 lines
1.1 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
plistPath = "${config.out}/user/Library/LaunchAgents/org.nixos.lorri.plist";
expectedPath = "${lib.makeBinPath [
config.nix.package
pkgs.git
pkgs.gnutar
pkgs.gzip
]}";
expectedNixPath = "${"nixpkgs=" + toString pkgs.path}";
in
{
services.lorri.enable = true;
test = ''
PATH=${
lib.makeBinPath [
pkgs.xcbuild
pkgs.jq
]
}:$PATH
plutil -lint ${plistPath}
plutil -convert json -o service.json ${plistPath}
<service.json jq -e ".EnvironmentVariables.PATH == \"${expectedPath}\""
<service.json jq -e ".EnvironmentVariables.NIX_PATH == \"${expectedNixPath}\""
<service.json jq -e ".KeepAlive == true"
<service.json jq -e ".Label == \"org.nixos.lorri\""
<service.json jq -e ".ProcessType == \"Background\""
<service.json jq -e ".ProgramArguments|length == 1"
<service.json jq -e ".ProgramArguments[0] == \"${pkgs.lorri}/bin/lorri daemon\""
<service.json jq -e ".RunAtLoad == true"
'';
}