mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
fd7d88f603
most likely, people enabling the lorri module also want to use it, without explicitly having to add it to users.users.<username>.packages. cc @curiousleo @Profpatsch
48 lines
1.2 KiB
Nix
48 lines
1.2 KiB
Nix
{ 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" ];
|
|
path = with pkgs; [ config.nix.package gnutar gzip ];
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.lorri}/bin/lorri daemon";
|
|
PrivateTmp = true;
|
|
ProtectSystem = "strict";
|
|
ProtectHome = "read-only";
|
|
Restart = "on-failure";
|
|
};
|
|
};
|
|
|
|
environment.systemPackages = [ pkgs.lorri ];
|
|
};
|
|
}
|