2023-05-22 19:39:52 -06:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
let cfg = config.services.pr-status;
|
|
|
|
in {
|
|
|
|
options = with lib; {
|
|
|
|
services.pr-status = {
|
|
|
|
enable = lib.mkEnableOption "Enable pr-status";
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 3003;
|
|
|
|
description = ''
|
|
|
|
Port to listen on
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
user = mkOption {
|
|
|
|
type = with types; oneOf [ str int ];
|
|
|
|
default = "pr-status";
|
|
|
|
description = ''
|
|
|
|
The user the service will use.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
group = mkOption {
|
|
|
|
type = with types; oneOf [ str int ];
|
|
|
|
default = "pr-status";
|
|
|
|
description = ''
|
|
|
|
The group the service will use.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.pr-status;
|
|
|
|
defaultText = literalExpression "pkgs.pr-status";
|
|
|
|
description = "The package to use for pr-status";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf (cfg.enable) {
|
|
|
|
users.groups.${cfg.group} = { };
|
|
|
|
users.users.${cfg.user} = {
|
|
|
|
description = "pr-status service user";
|
|
|
|
isSystemUser = true;
|
|
|
|
home = "/var/lib/pr-status";
|
|
|
|
createHome = true;
|
|
|
|
group = "${cfg.group}";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.pr-status = {
|
|
|
|
enable = true;
|
|
|
|
description = "pr-status server";
|
2024-07-01 11:03:53 -06:00
|
|
|
after = [ "network-online.target" ];
|
2024-06-17 19:42:14 -06:00
|
|
|
wants = [ "network-online.target" ];
|
2024-07-01 11:03:53 -06:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2023-05-22 19:39:52 -06:00
|
|
|
|
|
|
|
environment = { HOME = "/var/lib/pr-status"; };
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
User = cfg.user;
|
|
|
|
Group = cfg.group;
|
|
|
|
|
|
|
|
ExecStart =
|
|
|
|
"${cfg.package}/bin/pr-status.pl daemon -m production -l http://127.0.0.1:${
|
|
|
|
toString cfg.port
|
|
|
|
}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|