aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/services/lorri.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/modules/services/lorri.nix')
-rw-r--r--home-manager/modules/services/lorri.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/home-manager/modules/services/lorri.nix b/home-manager/modules/services/lorri.nix
new file mode 100644
index 00000000000..6183699088b
--- /dev/null
+++ b/home-manager/modules/services/lorri.nix
@@ -0,0 +1,60 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.lorri;
+
+in {
+ meta.maintainers = [ maintainers.gerschtli ];
+
+ options.services.lorri = {
+ enable = mkEnableOption "lorri build daemon";
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.lorri;
+ defaultText = literalExample "pkgs.lorri";
+ description = "Which lorri package to install.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ cfg.package ];
+
+ systemd.user = {
+ services.lorri = {
+ Unit = {
+ Description = "lorri build daemon";
+ Requires = "lorri.socket";
+ After = "lorri.socket";
+ RefuseManualStart = true;
+ };
+
+ Service = {
+ ExecStart = "${cfg.package}/bin/lorri daemon";
+ PrivateTmp = true;
+ ProtectSystem = "strict";
+ ProtectHome = "read-only";
+ Restart = "on-failure";
+ Environment = let
+ path = with pkgs;
+ makeSearchPath "bin" [ nix gitMinimal gnutar gzip ];
+ in [ "PATH=${path}" ];
+ };
+ };
+
+ sockets.lorri = {
+ Unit = { Description = "Socket for lorri build daemon"; };
+
+ Socket = {
+ ListenStream = "%t/lorri/daemon.socket";
+ RuntimeDirectory = "lorri";
+ };
+
+ Install = { WantedBy = [ "sockets.target" ]; };
+ };
+ };
+ };
+}