Files
nixpkgs/nixos/modules/services/networking/scion/scion-control.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

82 lines
2.1 KiB
Nix

{
config,
lib,
pkgs,
...
}:
with lib;
let
globalCfg = config.services.scion;
cfg = config.services.scion.scion-control;
toml = pkgs.formats.toml { };
connectionDir = if globalCfg.stateless then "/run" else "/var/lib";
defaultConfig = {
general = {
id = "cs";
config_dir = "/etc/scion";
};
beacon_db = {
connection = "${connectionDir}/scion-control/control.beacon.db";
};
path_db = {
connection = "${connectionDir}/scion-control/control.path.db";
};
trust_db = {
connection = "${connectionDir}/scion-control/control.trust.db";
};
log.console = {
level = "info";
};
};
configFile = toml.generate "scion-control.toml" (recursiveUpdate defaultConfig cfg.settings);
in
{
options.services.scion.scion-control = {
enable = mkEnableOption "the scion-control service";
settings = mkOption {
default = { };
type = toml.type;
example = literalExpression ''
{
path_db = {
connection = "/run/scion-control/control.path.db";
};
log.console = {
level = "info";
};
}
'';
description = ''
scion-control configuration. Refer to
<https://docs.scion.org/en/latest/manuals/common.html>
for details on supported values.
'';
};
};
config = mkIf cfg.enable {
systemd.services.scion-control = {
description = "SCION Control Service";
after = [
"network-online.target"
"scion-dispatcher.service"
];
wants = [
"network-online.target"
"scion-dispatcher.service"
];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
Group = if (config.services.scion.scion-dispatcher.enable == true) then "scion" else null;
ExecStart = "${globalCfg.package}/bin/scion-control --config ${configFile}";
DynamicUser = true;
Restart = "on-failure";
BindPaths = [ "/dev/shm:/run/shm" ];
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-control";
};
};
};
}