blob: d512b48539b8f7b072582905d0acc28d1d505907 (
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
49
50
51
|
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.phylactery;
in {
options.services.phylactery = {
enable = mkEnableOption "Whether to enable Phylactery server";
host = mkOption {
type = types.str;
default = "localhost";
description = lib.mdDoc "Listen host for Phylactery";
};
port = mkOption {
type = types.port;
description = lib.mdDoc "Listen port for Phylactery";
};
library = mkOption {
type = types.path;
description = lib.mdDoc "Path to CBZ library";
};
package = mkOption {
type = types.package;
default = pkgs.phylactery;
defaultText = literalExpression "pkgs.phylactery";
description = lib.mdDoc "The Phylactery package to use";
};
};
config = mkIf cfg.enable {
systemd.services.phylactery = {
environment = {
PHYLACTERY_ADDRESS = "${cfg.host}:${toString cfg.port}";
PHYLACTERY_LIBRARY = "${cfg.library}";
};
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ConditionPathExists = cfg.library;
DynamicUser = true;
ExecStart = "${cfg.package}/bin/phylactery";
};
};
};
meta.maintainers = with maintainers; [ McSinyx ];
}
|