blob: 6473232e632287ba908c017c7fe3a995c837086f (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
{ options
, lib
, config
, pkgs
, ...
}:
let
cfg = config.services.dragons;
in
{
options.services.dragons = {
enable = lib.mkEnableOption "Enable the dragons service";
port = lib.mkOption {
type = lib.types.int;
default = 3000;
description = ''
The port on which dragons will listen for
incoming HTTP traffic.
'';
};
keep = lib.mkOption {
type = lib.types.path;
default = "/var/dragons/keep";
description = "Keep location";
};
depo = lib.mkOption {
type = lib.types.path;
default = "/var/dragons/depo";
description = "depo location";
};
package = lib.mkOption {
type = lib.types.package;
description = "dragons package to use";
};
};
config = lib.mkIf cfg.enable {
systemd.services.dragons = {
path = [ cfg.package pkgs.git ];
wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -p ${cfg.keep}
mkdir -p ${cfg.depo}
'';
script = ''
${cfg.package}/bin/dragons
'';
description = ''
Dragons
'';
serviceConfig = {
Environment = [
"PORT=${toString cfg.port}"
"AREA=Live"
"DEPO=${cfg.depo}"
"KEEP=${cfg.keep}"
];
EnvironmentFile="/run/dragons/env";
KillSignal = "INT";
Type = "simple";
Restart = "on-abort";
RestartSec = "1";
};
};
};
}
|