mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-13 20:30:02 +00:00
Removes zsh and getEnv and adds needed NIX_PATH env.
This commit is contained in:
parent
30593350fd
commit
91504bd926
2 changed files with 14 additions and 12 deletions
|
@ -4,7 +4,6 @@ with lib;
|
|||
|
||||
let
|
||||
cfg = config.services.lorri;
|
||||
home = "${builtins.getEnv "HOME"}";
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
@ -14,11 +13,11 @@ in
|
|||
default = false;
|
||||
description = "Whether to enable the lorri service.";
|
||||
};
|
||||
|
||||
|
||||
logFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = "${home}/Library/Logs/lorri.log";
|
||||
example = "${home}/Library/Logs/lorri.log";
|
||||
default = "/var/tmp/lorri.log";
|
||||
example = "/var/tmp/lorri.log";
|
||||
description = ''
|
||||
The logfile to use for the lorri service. Alternatively
|
||||
<command>sudo launchctl debug system/com.target.lorri --stderr</command>
|
||||
|
@ -32,14 +31,15 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.lorri ];
|
||||
launchd.user.agents.lorri = {
|
||||
command = with pkgs; "${lorri}/bin/lorri daemon";
|
||||
path = with pkgs; [ nix ];
|
||||
serviceConfig = {
|
||||
Label = "com.target.lorri";
|
||||
ProgramArguments = with pkgs; ["${zsh}/bin/zsh" "-c" "${lorri}/bin/lorri daemon"];
|
||||
KeepAlive = true;
|
||||
RunAtLoad = true;
|
||||
ProcessType = "Background";
|
||||
StandardOutPath = cfg.logFile;
|
||||
StandardErrorPath = cfg.logFile;
|
||||
EnvironmentVariables = { NIX_PATH = "nixpkgs=" + toString pkgs.path; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
nix = pkgs.runCommand "nix-0.0.0" { version = "1.11.6"; } "mkdir -p $out";
|
||||
plistPath = "${config.out}/user/Library/LaunchAgents/com.target.lorri.plist";
|
||||
lorri = pkgs.runCommand "lorri-0.0.0" {} "mkdir $out";
|
||||
plistPath = "${config.out}/user/Library/LaunchAgents/org.nixos.lorri.plist";
|
||||
in
|
||||
{
|
||||
services.lorri.enable = true;
|
||||
nix.package = pkgs.nix;
|
||||
|
||||
test = ''
|
||||
echo checking lorri service in /Library/LaunchAgents >&2
|
||||
grep -o "<key>NIX_PATH</key>" ${plistPath}
|
||||
grep -o "<key>EnvironmentVariables</key>" ${plistPath}
|
||||
grep -o "<string>nixpkgs=" ${plistPath}
|
||||
grep -o "<key>KeepAlive</key>" ${plistPath}
|
||||
grep -o "<key>RunAtLoad</key>" ${plistPath}
|
||||
grep -o "<key>ProcessType</key>" ${plistPath}
|
||||
grep -o "<string>Background</string>" ${plistPath}
|
||||
grep -o "<string>com.target.lorri</string>" ${plistPath}
|
||||
grep -o "<string>${pkgs.zsh}/bin/zsh</string>" ${plistPath}
|
||||
grep -o "<string>/bin/sh</string>" ${plistPath}
|
||||
grep -o "<string>org.nixos.lorri</string>" ${plistPath}
|
||||
grep -o "<string>-c</string>" ${plistPath}
|
||||
grep -o "<string>${pkgs.lorri}/bin/lorri daemon</string>" ${plistPath}
|
||||
grep -o "<string>exec ${pkgs.lorri}/bin/lorri daemon</string>" ${plistPath}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue