Skip to content

Commit

Permalink
Merge pull request #274425 from woffs/fix-274286
Browse files Browse the repository at this point in the history
nixos/frr: adapt to frr-9
  • Loading branch information
mweinelt committed May 30, 2024
2 parents 13450ab + 4df9551 commit e0f4e4b
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions nixos/modules/services/networking/frr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ let
"pbr"
"bfd"
"fabric"
"mgmt"
];

allServices = services ++ [ "zebra" ];
allServices = services ++ [ "zebra" "mgmt" ];

isEnabled = service: cfg.${service}.enable;

Expand Down Expand Up @@ -137,6 +136,20 @@ in
'';
};
};
mgmt = (serviceOptions "mgmt") // {
enable = mkOption {
type = types.bool;
default = isEnabled "static";
defaultText = lib.literalExpression "config.services.frr.static.enable";
description = ''
Whether to enable the Configuration management daemon.
The Configuration management daemon is automatically
enabled if needed, at the moment this is when staticd
is enabled.
'';
};
};
};
}
{ options.services.frr = (genAttrs services serviceOptions); }
Expand Down Expand Up @@ -164,7 +177,7 @@ in

environment.etc = let
mkEtcLink = service: {
name = "frr/${service}.conf";
name = "frr/${daemonName service}.conf";
value.source = configFile service;
};
in
Expand Down Expand Up @@ -196,18 +209,18 @@ in
unitConfig.Documentation = if service == "zebra" then "man:zebra(8)"
else "man:${daemon}(8) man:zebra(8)";

restartTriggers = [
restartTriggers = mkIf (service != "mgmt") [
(configFile service)
];
reloadIfChanged = true;
reloadIfChanged = (service != "mgmt");

serviceConfig = {
PIDFile = "frr/${daemon}.pid";
ExecStart = "${pkgs.frr}/libexec/frr/${daemon} -f /etc/frr/${service}.conf"
ExecStart = "${pkgs.frr}/libexec/frr/${daemon}"
+ optionalString (scfg.vtyListenAddress != "") " -A ${scfg.vtyListenAddress}"
+ 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";
ExecReload = mkIf (service != "mgmt") "${pkgs.python3.interpreter} ${pkgs.frr}/libexec/frr/frr-reload.py --reload --daemon ${daemon} --bindir ${pkgs.frr}/bin --rundir /run/frr /etc/frr/${daemon}.conf";
Restart = "on-abnormal";
};
});
Expand Down

0 comments on commit e0f4e4b

Please sign in to comment.