1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/tests/services-lorri.nix

36 lines
1 KiB
Nix
Raw Normal View History

2020-05-12 17:20:29 +00:00
{ config, pkgs, ... }:
let
lorri = pkgs.runCommand "lorri-0.0.0" {} "mkdir $out";
plistPath = "${config.out}/user/Library/LaunchAgents/org.nixos.lorri.plist";
actual = pkgs.runCommand "convert-plist-to-json" { buildInputs = [ pkgs.xcbuild ]; }
"plutil -convert json -o $out ${plistPath}";
actualJson = builtins.fromJSON (builtins.readFile "${actual.out}");
expectedJson = builtins.fromJSON ''
{
"EnvironmentVariables": {
"NIX_PATH": "${"nixpkgs="+ toString pkgs.path}",
"PATH": "${builtins.unsafeDiscardStringContext pkgs.nix}/bin"
},
"KeepAlive": true,
"Label": "org.nixos.lorri",
"ProcessType": "Background",
"ProgramArguments": [
"/bin/sh",
"-c",
"exec ${builtins.unsafeDiscardStringContext pkgs.lorri}/bin/lorri daemon"
],
"RunAtLoad": true
}
'';
testResult = toString (actualJson == expectedJson);
2020-05-12 17:20:29 +00:00
in
{
services.lorri.enable = true;
test = ''
${pkgs.xcbuild}/bin/plutil -lint ${plistPath}
[ ${testResult} ];
2020-05-12 17:20:29 +00:00
'';
}