0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 14:10:33 +03:00
nixpkgs/nixos/modules/services/networking/scion/scion-router.nix
2024-06-27 11:51:28 +02:00

49 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.scion.scion-router;
toml = pkgs.formats.toml { };
defaultConfig = {
general = {
id = "br";
config_dir = "/etc/scion";
};
};
configFile = toml.generate "scion-router.toml" (recursiveUpdate defaultConfig cfg.settings);
in
{
options.services.scion.scion-router = {
enable = mkEnableOption "the scion-router service";
settings = mkOption {
default = { };
type = toml.type;
example = literalExpression ''
{
general.id = "br";
}
'';
description = ''
scion-router configuration. Refer to
<https://docs.scion.org/en/latest/manuals/common.html>
for details on supported values.
'';
};
};
config = mkIf cfg.enable {
systemd.services.scion-router = {
description = "SCION Router";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.scion}/bin/scion-router --config ${configFile}";
Restart = "on-failure";
DynamicUser = true;
StateDirectory = "scion-router";
};
};
};
}