1 { config, lib, pkgs, ... }:
4 cfg = config.services.lorri;
5 socketPath = "lorri/daemon.socket";
9 enable = lib.mkOption {
11 type = lib.types.bool;
13 Enables the daemon for `lorri`, a nix-shell replacement for project
14 development. The socket-activated daemon starts on the first request
15 issued by the `lorri` command.
18 package = lib.mkOption {
20 type = lib.types.package;
22 The lorri package to use.
24 defaultText = lib.literalExpression "pkgs.lorri";
29 config = lib.mkIf cfg.enable {
30 systemd.user.sockets.lorri = {
31 description = "Socket for Lorri Daemon";
32 wantedBy = [ "sockets.target" ];
34 ListenStream = "%t/${socketPath}";
35 RuntimeDirectory = "lorri";
39 systemd.user.services.lorri = {
40 description = "Lorri Daemon";
41 requires = [ "lorri.socket" ];
42 after = [ "lorri.socket" ];
43 path = with pkgs; [ config.nix.package git gnutar gzip ];
45 ExecStart = "${cfg.package}/bin/lorri daemon";
47 ProtectSystem = "full";
48 Restart = "on-failure";
52 environment.systemPackages = [ cfg.package pkgs.direnv ];