1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-16 13:28:16 +00:00
nix-darwin/modules/services/lorri.nix

46 lines
1.3 KiB
Nix
Raw Normal View History

2020-05-12 19:20:29 +02:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.lorri;
2020-08-29 16:32:49 +02:00
home = "${builtins.getEnv "HOME"}";
2020-05-12 19:20:29 +02:00
in
{
2020-08-29 16:32:49 +02:00
options = {
services.lorri = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the lorri service.";
};
2020-05-12 19:20:29 +02:00
2020-08-29 16:32:49 +02:00
logFile = mkOption {
type = types.nullOr types.path;
default = "${home}/Library/Logs/lorri.log";
example = "${home}/Library/Logs/lorri.log";
description = ''
The logfile to use for the lorri service. Alternatively
<command>sudo launchctl debug system/com.target.lorri --stderr</command>
can be used to stream the logs to a shell after restarting the service with
<command>sudo launchctl kickstart -k system/com.target.lorri</command>.
'';
};
2020-05-12 19:20:29 +02:00
};
};
config = mkIf cfg.enable {
2020-08-29 16:32:49 +02:00
environment.systemPackages = [ pkgs.lorri ];
2020-05-12 19:20:29 +02:00
launchd.user.agents.lorri = {
serviceConfig = {
2020-08-29 16:32:49 +02:00
Label = "com.target.lorri";
ProgramArguments = with pkgs; ["${zsh}/bin/zsh" "-c" "${lorri}/bin/lorri daemon"];
2020-05-12 19:20:29 +02:00
KeepAlive = true;
2020-08-29 16:32:49 +02:00
RunAtLoad = true;
2020-05-12 19:20:29 +02:00
ProcessType = "Background";
StandardOutPath = cfg.logFile;
StandardErrorPath = cfg.logFile;
};
};
};
}