blob: ad07507ca37db9de62b7737639db73b641dc4261 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.services.pict-rs;
in
{
meta.maintainers = with maintainers; [ happysalada ];
meta.doc = ./pict-rs.xml;
options.services.pict-rs = {
enable = mkEnableOption (lib.mdDoc "pict-rs server");
dataDir = mkOption {
type = types.path;
default = "/var/lib/pict-rs";
description = lib.mdDoc ''
The directory where to store the uploaded images.
'';
};
address = mkOption {
type = types.str;
default = "127.0.0.1";
description = lib.mdDoc ''
The IPv4 address to deploy the service to.
'';
};
port = mkOption {
type = types.port;
default = 8080;
description = lib.mdDoc ''
The port which to bind the service to.
'';
};
};
config = lib.mkIf cfg.enable {
systemd.services.pict-rs = {
environment = {
PICTRS_PATH = cfg.dataDir;
PICTRS_ADDR = "${cfg.address}:${toString cfg.port}";
};
wantedBy = [ "multi-user.target" ];
serviceConfig = {
DynamicUser = true;
StateDirectory = "pict-rs";
ExecStart = "${pkgs.pict-rs}/bin/pict-rs";
};
};
};
}
|