blob: 47ff320b6a8ff61ce5712c2e7de32960a975169e (
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
|
{ config, lib, pkgs, ... }:
with lib;
let
globalCfg = config.services.scion;
cfg = config.services.scion.scion-router;
toml = pkgs.formats.toml { };
defaultConfig = {
general = {
id = "br";
config_dir = "/etc/scion";
};
};
configFile = toml.generate "scion-router.toml" (recursiveUpdate defaultConfig cfg.settings);
in
{
options.services.scion.scion-router = {
enable = mkEnableOption "the scion-router service";
settings = mkOption {
default = { };
type = toml.type;
example = literalExpression ''
{
general.id = "br";
}
'';
description = ''
scion-router configuration. Refer to
<https://docs.scion.org/en/latest/manuals/common.html>
for details on supported values.
'';
};
};
config = mkIf cfg.enable {
systemd.services.scion-router = {
description = "SCION Router";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.scion}/bin/scion-router --config ${configFile}";
Restart = "on-failure";
DynamicUser = true;
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-router";
};
};
};
}
|