1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-14 00:25:24 +00:00
nixpkgs/nixos/modules/services/development/lorri.nix

57 lines
1.5 KiB
Nix
Raw Normal View History

2019-11-08 17:18:03 +00: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.
'';
};
2020-09-06 17:04:31 +01:00
package = lib.mkOption {
default = pkgs.lorri;
type = lib.types.package;
description = ''
The lorri package to use.
'';
defaultText = lib.literalExample "pkgs.lorri";
example = lib.literalExample "pkgs.lorri";
};
2019-11-08 17:18:03 +00:00
};
};
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 git gnutar gzip ];
2019-11-08 17:18:03 +00:00
serviceConfig = {
2020-09-06 17:04:31 +01:00
ExecStart = "${cfg.package}/bin/lorri daemon";
2019-11-08 17:18:03 +00:00
PrivateTmp = true;
ProtectSystem = "strict";
ProtectHome = "read-only";
Restart = "on-failure";
};
};
2020-09-06 17:04:31 +01:00
environment.systemPackages = [ cfg.package ];
2019-11-08 17:18:03 +00:00
};
}