1 { config, lib, pkgs, ... }:
6 globalCfg = config.services.scion;
7 cfg = config.services.scion.scion-daemon;
8 toml = pkgs.formats.toml { };
9 connectionDir = if globalCfg.stateless then "/run" else "/var/lib";
13 config_dir = "/etc/scion";
14 reconnect_to_dispatcher = true;
17 connection = "${connectionDir}/scion-daemon/sd.path.db";
20 connection = "${connectionDir}/scion-daemon/sd.trust.db";
26 configFile = toml.generate "scion-daemon.toml" (recursiveUpdate defaultConfig cfg.settings);
29 options.services.scion.scion-daemon = {
30 enable = mkEnableOption "the scion-daemon service";
34 example = literalExpression ''
37 connection = "/run/scion-daemon/sd.path.db";
45 scion-daemon configuration. Refer to
46 <https://docs.scion.org/en/latest/manuals/common.html>
47 for details on supported values.
51 config = mkIf cfg.enable {
52 systemd.services.scion-daemon = {
53 description = "SCION Daemon";
54 after = [ "network-online.target" "scion-dispatcher.service" ];
55 wants = [ "network-online.target" "scion-dispatcher.service" ];
56 wantedBy = [ "multi-user.target" ];
59 ExecStart = "${globalCfg.package}/bin/scion-daemon --config ${configFile}";
60 Restart = "on-failure";
62 ${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-daemon";