11 globalCfg = config.services.scion;
12 cfg = config.services.scion.scion-dispatcher;
13 toml = pkgs.formats.toml { };
17 socket_file_mode = "0770";
18 application_socket = "/dev/shm/dispatcher/default.sock";
24 configFile = toml.generate "scion-dispatcher.toml" (recursiveUpdate defaultConfig cfg.settings);
27 options.services.scion.scion-dispatcher = {
28 enable = mkEnableOption "the scion-dispatcher service";
32 example = literalExpression ''
36 socket_file_mode = "0770";
37 application_socket = "/dev/shm/dispatcher/default.sock";
45 scion-dispatcher 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 # Needed for group ownership of the dispatcher socket
53 users.groups.scion = { };
55 # scion programs hardcode path to dispatcher in /run/shm, and is not
56 # configurable at runtime upstream plans to obsolete the dispatcher in
57 # favor of an SCMP daemon, at which point this can be removed.
58 system.activationScripts.scion-dispatcher = ''
59 ln -sf /dev/shm /run/shm
62 systemd.services.scion-dispatcher = {
63 description = "SCION Dispatcher";
64 after = [ "network-online.target" ];
65 wants = [ "network-online.target" ];
66 wantedBy = [ "multi-user.target" ];
71 BindPaths = [ "/dev/shm:/run/shm" ];
72 ExecStartPre = "${pkgs.coreutils}/bin/rm -rf /run/shm/dispatcher";
73 ExecStart = "${globalCfg.package}/bin/scion-dispatcher --config ${configFile}";
74 Restart = "on-failure";
75 ${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-dispatcher";