From d037dfaf20b31aa72b394e3135cf5c8ccebbefc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20Ackerman?= <6054733+akrmn@users.noreply.github.com> Date: Sat, 31 Oct 2020 19:41:41 +0100 Subject: [PATCH] add git, gnutar and gzip to lorri's path --- modules/services/lorri.nix | 2 +- tests/services-lorri.nix | 44 ++++++++++++++++---------------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/modules/services/lorri.nix b/modules/services/lorri.nix index 354bcf4..f637b9c 100644 --- a/modules/services/lorri.nix +++ b/modules/services/lorri.nix @@ -32,7 +32,7 @@ in environment.systemPackages = [ pkgs.lorri ]; launchd.user.agents.lorri = { command = with pkgs; "${lorri}/bin/lorri daemon"; - path = with pkgs; [ nix ]; + path = with pkgs; [ config.nix.package git gnutar gzip ]; serviceConfig = { KeepAlive = true; RunAtLoad = true; diff --git a/tests/services-lorri.nix b/tests/services-lorri.nix index f66c16f..52dcc91 100644 --- a/tests/services-lorri.nix +++ b/tests/services-lorri.nix @@ -1,35 +1,27 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: 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); + expectedPath = "${lib.makeBinPath [config.nix.package pkgs.git pkgs.gnutar pkgs.gzip]}"; + expectedNixPath = "${"nixpkgs="+ toString pkgs.path}"; in { services.lorri.enable = true; test = '' - ${pkgs.xcbuild}/bin/plutil -lint ${plistPath} - [ ${testResult} ]; + PATH=${lib.makeBinPath [ pkgs.xcbuild pkgs.jq ]}:$PATH + + plutil -lint ${plistPath} + plutil -convert json -o service.json ${plistPath} + +