mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-07 21:43:32 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
70 lines
1.9 KiB
Nix
70 lines
1.9 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.scion.scion-control;
|
|
toml = pkgs.formats.toml { };
|
|
defaultConfig = {
|
|
general = {
|
|
id = "cs";
|
|
config_dir = "/etc/scion";
|
|
reconnect_to_dispatcher = true;
|
|
};
|
|
beacon_db = {
|
|
connection = "/var/lib/scion-control/control.beacon.db";
|
|
};
|
|
path_db = {
|
|
connection = "/var/lib/scion-control/control.path.db";
|
|
};
|
|
trust_db = {
|
|
connection = "/var/lib/scion-control/control.trust.db";
|
|
};
|
|
log.console = {
|
|
level = "info";
|
|
};
|
|
};
|
|
configFile = toml.generate "scion-control.toml" (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 = "/var/lib/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 = "${pkgs.scion}/bin/scion-control --config ${configFile}";
|
|
DynamicUser = true;
|
|
Restart = "on-failure";
|
|
BindPaths = [ "/dev/shm:/run/shm" ];
|
|
StateDirectory = "scion-control";
|
|
};
|
|
};
|
|
};
|
|
}
|