11 globalCfg = config.services.scion;
12 cfg = config.services.scion.scion-ip-gateway;
13 toml = pkgs.formats.toml { };
14 json = pkgs.formats.json { };
15 connectionDir = if globalCfg.stateless then "/run" else "/var/lib";
19 traffic_policy_file = "${trafficConfigFile}";
22 defaultTrafficConfig = {
26 configFile = toml.generate "scion-ip-gateway.toml" (recursiveUpdate defaultConfig cfg.config);
27 trafficConfigFile = json.generate "scion-ip-gateway-traffic.json" (
28 recursiveUpdate defaultTrafficConfig cfg.trafficConfig
32 options.services.scion.scion-ip-gateway = {
33 enable = mkEnableOption "the scion-ip-gateway service";
37 example = literalExpression ''
40 src_ipv4 = "172.16.100.1";
45 scion-ip-gateway daemon configuration
48 trafficConfig = mkOption {
51 example = literalExpression ''
64 scion-ip-gateway traffic configuration
68 config = mkIf cfg.enable {
69 systemd.services.scion-ip-gateway = {
70 description = "SCION IP Gateway Service";
72 "network-online.target"
73 "scion-dispatcher.service"
76 "network-online.target"
77 "scion-dispatcher.service"
79 wantedBy = [ "multi-user.target" ];
82 Group = if (config.services.scion.scion-dispatcher.enable == true) then "scion" else null;
83 ExecStart = "${globalCfg.package}/bin/scion-ip-gateway --config ${configFile}";
85 AmbientCapabilities = [ "CAP_NET_ADMIN" ];
86 Restart = "on-failure";
87 KillMode = "control-group";
88 RemainAfterExit = false;