nixos/frr: add extraOptions option

Support passing options to daemons. For example, bgpd needs '-M rpki' to
enable rpki functions.
This commit is contained in:
Anillc 2022-05-09 10:34:52 +08:00
parent f7846451a1
commit 6958412083
No known key found for this signature in database
GPG Key ID: 0BE8A88F47B2145C

View File

@ -106,6 +106,14 @@ let
TCP Port to bind to for the VTY interface.
'';
};
extraOptions = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Extra options for the daemon.
'';
};
};
in
@ -196,7 +204,8 @@ in
PIDFile = "frr/${daemon}.pid";
ExecStart = "${pkgs.frr}/libexec/frr/${daemon} -f /etc/frr/${service}.conf"
+ optionalString (scfg.vtyListenAddress != "") " -A ${scfg.vtyListenAddress}"
+ optionalString (scfg.vtyListenPort != null) " -P ${toString scfg.vtyListenPort}";
+ optionalString (scfg.vtyListenPort != null) " -P ${toString scfg.vtyListenPort}"
+ " " + (concatStringsSep " " scfg.extraOptions);
ExecReload = "${pkgs.python3.interpreter} ${pkgs.frr}/libexec/frr/frr-reload.py --reload --daemon ${daemonName service} --bindir ${pkgs.frr}/bin --rundir /run/frr /etc/frr/${service}.conf";
Restart = "on-abnormal";
};