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;
|
2024-04-14 21:02:32 +00:00
|
|
|
description = "Whether to enable the lorri service.";
|
2020-08-29 14:32:49 +00:00
|
|
|
};
|
2020-08-30 16:06:40 +00:00
|
|
|
|
2020-08-29 14:32:49 +00:00
|
|
|
logFile = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
2020-08-31 11:07:06 +00:00
|
|
|
default = null;
|
2020-08-30 16:06:40 +00:00
|
|
|
example = "/var/tmp/lorri.log";
|
2024-04-14 21:02:32 +00:00
|
|
|
description = ''
|
2020-08-29 14:32:49 +00:00
|
|
|
The logfile to use for the lorri service. Alternatively
|
2023-06-22 11:21:32 +00:00
|
|
|
{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
|
2023-06-22 11:21:32 +00:00
|
|
|
{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 = {
|
2020-08-30 16:06:40 +00:00
|
|
|
command = with pkgs; "${lorri}/bin/lorri daemon";
|
2020-10-31 18:41:41 +00:00
|
|
|
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;
|
2020-08-30 16:06:40 +00:00
|
|
|
EnvironmentVariables = { NIX_PATH = "nixpkgs=" + toString pkgs.path; };
|
2020-05-12 17:20:29 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|