2019-11-08 18:18:03 +01:00
|
|
|
{ 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" ];
|
2019-12-16 10:09:59 +01:00
|
|
|
path = with pkgs; [ config.nix.package git gnutar gzip ];
|
2019-11-08 18:18:03 +01:00
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.lorri}/bin/lorri daemon";
|
|
|
|
PrivateTmp = true;
|
|
|
|
ProtectSystem = "strict";
|
|
|
|
ProtectHome = "read-only";
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
2019-11-15 16:41:00 +01:00
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.lorri ];
|
2019-11-08 18:18:03 +01:00
|
|
|
};
|
|
|
|
}
|