2020-05-12 17:20:29 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2020-08-30 16:06:40 +00:00
|
|
|
lorri = pkgs.runCommand "lorri-0.0.0" {} "mkdir $out";
|
|
|
|
plistPath = "${config.out}/user/Library/LaunchAgents/org.nixos.lorri.plist";
|
2020-08-31 11:07:06 +00:00
|
|
|
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 = ''
|
2020-08-31 11:07:06 +00:00
|
|
|
${pkgs.xcbuild}/bin/plutil -lint ${plistPath}
|
|
|
|
[ ${testResult} ];
|
2020-05-12 17:20:29 +00:00
|
|
|
'';
|
|
|
|
}
|
2020-08-31 11:07:06 +00:00
|
|
|
|