From 9f94ecb8d3523dafcdef122d6b146ebc3bf7ba2e Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Thu, 10 Oct 2019 01:05:45 +0200 Subject: [PATCH] (unsuccessful) attempt of running lorri daemon as user service --- home/home.nix | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/home/home.nix b/home/home.nix index b47ccc9..d44e16c 100644 --- a/home/home.nix +++ b/home/home.nix @@ -287,4 +287,48 @@ in terminal = "screen-256color"; }; + # lorri daemon service + systemd.user = with lib; { + services.lorri = { + Unit = { + Description = "Lorri build daemon"; + Documentation = "https://github.com/target/lorri"; + ConditionUser = "!@system"; + Requires = "lorri.socket"; + After = "lorri.socket"; + RefuseManualStart = true; + }; + + Service = { + ExecStart = "${lorri}/bin/lorri daemon"; + PrivateTmp = true; + ProtectSystem = "strict"; + WorkingDirectory = "%h"; + Restart = "on-failure"; + Environment = + let + path = with pkgs; makeSearchPath "bin" [ nix gnutar git mercurial ]; + in + concatStringsSep " " [ + "PATH=${path}" + "RUST_BACKTRACE=1" + ]; + }; + }; + + sockets.lorri = { + Unit = { + Description = "Socket for lorri build daemon"; + }; + + Socket = { + ListenStream = "%t/lorri/daemon.socket"; + }; + + Install = { + WantedBy = [ "sockets.target" ]; + }; + }; + }; + }