summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorThibault Gagnaux <thibault@gagnaux.ch>2020-05-12 19:20:29 +0200
committerThibault Gagnaux <thibault@gagnaux.ch>2020-08-29 16:35:43 +0200
commit11413f94b2d5eb97756edcec6c7a7b4f9a46ae73 (patch)
tree00afdbbfb14a27ed05907d10c97f36bf5b58492d /modules
parent943a6b25d7be58e45df9817139db2cb3808d3006 (diff)
Adds lorri service.
Diffstat (limited to 'modules')
-rw-r--r--modules/module-list.nix1
-rw-r--r--modules/services/lorri.nix59
2 files changed, 60 insertions, 0 deletions
diff --git a/modules/module-list.nix b/modules/module-list.nix
index 52b987d..6375ea3 100644
--- a/modules/module-list.nix
+++ b/modules/module-list.nix
@@ -43,6 +43,7 @@
./services/emacs.nix
./services/khd
./services/kwm
+ ./services/lorri.nix
./services/mail/offlineimap.nix
./services/mopidy.nix
./services/nix-daemon.nix
diff --git a/modules/services/lorri.nix b/modules/services/lorri.nix
new file mode 100644
index 0000000..142f574
--- /dev/null
+++ b/modules/services/lorri.nix
@@ -0,0 +1,59 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.lorri;
+in
+{
+ options = {
+ services.lorri.enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the lorri service.";
+ };
+
+ services.lorri.package = mkOption {
+ type = types.path;
+ default = pkgs.lorri;
+ defaultText = "pkgs.lorri";
+ description = "This option specifies the lorri package to use.";
+ };
+
+ services.lorri.logFile = mkOption {
+ type = types.nullOr types.path;
+ 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/org.nixos.lorri --stderr</command>
+ can be used to stream the logs to a shell after restarting the service with
+ <command>sudo launchctl kickstart -k system/org.nixos.lorri</command>.
+ '';
+ };
+
+ services.lorri.tempDir = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ description = "The TMPDIR to use for lorri.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = [ cfg.package ];
+ launchd.user.agents.lorri = {
+ serviceConfig = {
+ KeepAlive = true;
+ ProcessType = "Background";
+ LowPriorityIO = false;
+ StandardOutPath = cfg.logFile;
+ StandardErrorPath = cfg.logFile;
+ EnvironmentVariables = mkMerge [
+ config.nix.envVars
+ { TMPDIR = mkIf (cfg.tempDir != null) cfg.tempDir; }
+ ];
+ };
+ command = "${cfg.package}/bin/lorri daemon";
+ };
+ };
+} \ No newline at end of file