2019-11-16 21:05:08 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.lorri;
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
in {
|
2019-11-16 21:05:08 +00:00
|
|
|
meta.maintainers = [ maintainers.gerschtli ];
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
options = { services.lorri.enable = mkEnableOption "lorri build daemon"; };
|
2019-11-16 21:05:08 +00:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ pkgs.lorri ];
|
|
|
|
|
|
|
|
systemd.user = {
|
|
|
|
services.lorri = {
|
|
|
|
Unit = {
|
|
|
|
Description = "lorri build daemon";
|
|
|
|
Requires = "lorri.socket";
|
|
|
|
After = "lorri.socket";
|
|
|
|
RefuseManualStart = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
ExecStart = "${pkgs.lorri}/bin/lorri daemon";
|
|
|
|
PrivateTmp = true;
|
|
|
|
ProtectSystem = "strict";
|
|
|
|
ProtectHome = "read-only";
|
|
|
|
Restart = "on-failure";
|
2020-02-01 23:39:17 +00:00
|
|
|
Environment = let
|
|
|
|
path = with pkgs;
|
|
|
|
makeSearchPath "bin" [ nix gitMinimal gnutar gzip ];
|
|
|
|
in "PATH=${path}";
|
2019-11-16 21:05:08 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
sockets.lorri = {
|
2020-02-01 23:39:17 +00:00
|
|
|
Unit = { Description = "Socket for lorri build daemon"; };
|
2019-11-16 21:05:08 +00:00
|
|
|
|
|
|
|
Socket = {
|
|
|
|
ListenStream = "%t/lorri/daemon.socket";
|
|
|
|
RuntimeDirectory = "lorri";
|
|
|
|
};
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
Install = { WantedBy = [ "sockets.target" ]; };
|
2019-11-16 21:05:08 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|