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

46 lines
1.3 KiB
Nix
Raw Normal View History

2020-05-12 17:20:29 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.lorri;
in
{
2020-08-29 14:32:49 +00:00
options = {
services.lorri = {
enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc "Whether to enable the lorri service.";
2020-08-29 14:32:49 +00:00
};
2020-08-29 14:32:49 +00:00
logFile = mkOption {
type = types.nullOr types.path;
default = null;
example = "/var/tmp/lorri.log";
description = lib.mdDoc ''
2020-08-29 14:32:49 +00:00
The logfile to use for the lorri service. Alternatively
{command}`sudo launchctl debug system/org.nixos.lorri --stderr`
2020-08-29 14:32:49 +00:00
can be used to stream the logs to a shell after restarting the service with
{command}`sudo launchctl kickstart -k system/org.nixos.lorri`.
2020-08-29 14:32:49 +00:00
'';
};
2020-05-12 17:20:29 +00:00
};
};
config = mkIf cfg.enable {
2020-08-29 14:32:49 +00:00
environment.systemPackages = [ pkgs.lorri ];
2020-05-12 17:20:29 +00:00
launchd.user.agents.lorri = {
command = with pkgs; "${lorri}/bin/lorri daemon";
path = with pkgs; [ config.nix.package git gnutar gzip ];
2020-05-12 17:20:29 +00:00
serviceConfig = {
KeepAlive = true;
2020-08-29 14:32:49 +00:00
RunAtLoad = true;
2020-05-12 17:20:29 +00:00
ProcessType = "Background";
StandardOutPath = cfg.logFile;
StandardErrorPath = cfg.logFile;
EnvironmentVariables = { NIX_PATH = "nixpkgs=" + toString pkgs.path; };
2020-05-12 17:20:29 +00:00
};
};
};
}