summary refs log tree commit diff
path: root/nixos/modules/services/development
diff options
context:
space:
mode:
authorLeonhard Markert <curiousleo@users.noreply.github.com>2019-11-08 18:18:03 +0100
committerProfpatsch <mail@profpatsch.de>2019-11-14 16:06:27 +0100
commite5db97d2b002a57d6fac70d1f0a8314d25e94f28 (patch)
treeec3f6415dcf8a2dcf165b1c073b97c7c8ed2be60 /nixos/modules/services/development
parentceccff3439fdbb11ac2025bdd4578970f3c49e28 (diff)
downloadnixpkgs-e5db97d2b002a57d6fac70d1f0a8314d25e94f28.tar
nixpkgs-e5db97d2b002a57d6fac70d1f0a8314d25e94f28.tar.gz
nixpkgs-e5db97d2b002a57d6fac70d1f0a8314d25e94f28.tar.bz2
nixpkgs-e5db97d2b002a57d6fac70d1f0a8314d25e94f28.tar.lz
nixpkgs-e5db97d2b002a57d6fac70d1f0a8314d25e94f28.tar.xz
nixpkgs-e5db97d2b002a57d6fac70d1f0a8314d25e94f28.tar.zst
nixpkgs-e5db97d2b002a57d6fac70d1f0a8314d25e94f28.zip
lorri service module: init
Diffstat (limited to 'nixos/modules/services/development')
-rw-r--r--nixos/modules/services/development/lorri.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/nixos/modules/services/development/lorri.nix b/nixos/modules/services/development/lorri.nix
new file mode 100644
index 00000000000..618785ee53c
--- /dev/null
+++ b/nixos/modules/services/development/lorri.nix
@@ -0,0 +1,45 @@
+{ config, lib, pkgs, ... }:
+
+let
+  cfg = config.services.lorri;
+  socketPath = "lorri/daemon.socket";
+in {
+  options = {
+    services.lorri = {
+      enable = lib.mkOption {
+        default = false;
+        type = lib.types.bool;
+        description = ''
+          Enables the daemon for `lorri`, a nix-shell replacement for project
+          development. The socket-activated daemon starts on the first request
+          issued by the `lorri` command.
+        '';
+      };
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    systemd.user.sockets.lorri = {
+      description = "Socket for Lorri Daemon";
+      wantedBy = [ "sockets.target" ];
+      socketConfig = {
+        ListenStream = "%t/${socketPath}";
+        RuntimeDirectory = "lorri";
+      };
+    };
+
+    systemd.user.services.lorri = {
+      description = "Lorri Daemon";
+      requires = [ "lorri.socket" ];
+      after = [ "lorri.socket" ];
+      path = with pkgs; [ config.nix.package gnutar gzip ];
+      serviceConfig = {
+        ExecStart = "${pkgs.lorri}/bin/lorri daemon";
+        PrivateTmp = true;
+        ProtectSystem = "strict";
+        ProtectHome = "read-only";
+        Restart = "on-failure";
+      };
+    };
+  };
+}