summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2019-05-31 01:19:35 +0200
committerJanne Heß <janne@hess.ooo>2019-05-31 01:21:18 +0200
commit672495d5966bdfe15b397c994046e39d003e6a99 (patch)
treecc12a4bd92173790b5037ceed2b7e149548631a3 /nixos/modules
parent19195b212e78326f4308fd71914ce180c7553259 (diff)
nixos/bird: Fix reload
When calling reload, bird attempts to reload the file that was given in the command line. As the change of ${configFile} is never picked up, bird will just reload the old file. This way, the configuration is placed at a known location and updated.
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/networking/bird.nix21
1 files changed, 11 insertions, 10 deletions
diff --git a/nixos/modules/services/networking/bird.nix b/nixos/modules/services/networking/bird.nix
index 555733aab7c0..4ae35875c0f0 100644
--- a/nixos/modules/services/networking/bird.nix
+++ b/nixos/modules/services/networking/bird.nix
@@ -14,15 +14,6 @@ let
bird6 = "1.9.x with IPv6 suport";
bird2 = "2.x";
}.${variant};
- configFile = pkgs.stdenv.mkDerivation {
- name = "${variant}.conf";
- text = cfg.config;
- preferLocalBuild = true;
- buildCommand = ''
- echo -n "$text" > $out
- ${pkg}/bin/${birdBin} -d -p -c $out
- '';
- };
in {
###### interface
options = {
@@ -41,14 +32,24 @@ let
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ pkg ];
+
+ environment.etc."bird/${variant}.conf".source = pkgs.writeTextFile {
+ name = "${variant}.conf";
+ text = cfg.config;
+ checkPhase = ''
+ ${pkg}/bin/${birdBin} -d -p -c $out
+ '';
+ };
+
systemd.services.${variant} = {
description = "BIRD Internet Routing Daemon (${descr})";
wantedBy = [ "multi-user.target" ];
reloadIfChanged = true;
+ restartTriggers = [ config.environment.etc."bird/${variant}.conf".source ];
serviceConfig = {
Type = "forking";
Restart = "on-failure";
- ExecStart = "${pkg}/bin/${birdBin} -c ${configFile} -u ${variant} -g ${variant}";
+ ExecStart = "${pkg}/bin/${birdBin} -c /etc/bird/${variant}.conf -u ${variant} -g ${variant}";
ExecReload = "${pkg}/bin/${birdc} configure";
ExecStop = "${pkg}/bin/${birdc} down";
CapabilityBoundingSet = [ "CAP_CHOWN" "CAP_FOWNER" "CAP_DAC_OVERRIDE" "CAP_SETUID" "CAP_SETGID"