1 { config, lib, pkgs, ... }:
6 globalCfg = config.services.scion;
7 cfg = config.services.scion.scion-dispatcher;
8 toml = pkgs.formats.toml { };
12 socket_file_mode = "0770";
13 application_socket = "/dev/shm/dispatcher/default.sock";
19 configFile = toml.generate "scion-dispatcher.toml" (recursiveUpdate defaultConfig cfg.settings);
22 options.services.scion.scion-dispatcher = {
23 enable = mkEnableOption "the scion-dispatcher service";
27 example = literalExpression ''
31 socket_file_mode = "0770";
32 application_socket = "/dev/shm/dispatcher/default.sock";
40 scion-dispatcher configuration. Refer to
41 <https://docs.scion.org/en/latest/manuals/common.html>
42 for details on supported values.
46 config = mkIf cfg.enable {
47 # Needed for group ownership of the dispatcher socket
48 users.groups.scion = {};
50 # scion programs hardcode path to dispatcher in /run/shm, and is not
51 # configurable at runtime upstream plans to obsolete the dispatcher in
52 # favor of an SCMP daemon, at which point this can be removed.
53 system.activationScripts.scion-dispatcher = ''
54 ln -sf /dev/shm /run/shm
57 systemd.services.scion-dispatcher = {
58 description = "SCION Dispatcher";
59 after = [ "network-online.target" ];
60 wants = [ "network-online.target" ];
61 wantedBy = [ "multi-user.target" ];
66 BindPaths = [ "/dev/shm:/run/shm" ];
67 ExecStartPre = "${pkgs.coreutils}/bin/rm -rf /run/shm/dispatcher";
68 ExecStart = "${globalCfg.package}/bin/scion-dispatcher --config ${configFile}";
69 Restart = "on-failure";
70 ${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-dispatcher";