summary refs log tree commit diff
path: root/nixos/modules/services/networking/bird.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2021-03-18 14:17:43 +0100
committerFlorian Klink <flokli@flokli.de>2021-03-18 14:24:55 +0100
commit7d266264cec7f338bd22d74e573332c1cbbcbcf2 (patch)
tree451d5c35933729cbee485d54f25099760db28481 /nixos/modules/services/networking/bird.nix
parent96cb2a4d796c5c2003aa97e1cb95b2f50df6c3a7 (diff)
downloadnixpkgs-7d266264cec7f338bd22d74e573332c1cbbcbcf2.tar
nixpkgs-7d266264cec7f338bd22d74e573332c1cbbcbcf2.tar.gz
nixpkgs-7d266264cec7f338bd22d74e573332c1cbbcbcf2.tar.bz2
nixpkgs-7d266264cec7f338bd22d74e573332c1cbbcbcf2.tar.lz
nixpkgs-7d266264cec7f338bd22d74e573332c1cbbcbcf2.tar.xz
nixpkgs-7d266264cec7f338bd22d74e573332c1cbbcbcf2.tar.zst
nixpkgs-7d266264cec7f338bd22d74e573332c1cbbcbcf2.zip
nixos/bird: add services.bird*.checkConfig option
This is useful when the config doesn't entirely live in the Nix store,
but is configured to include mutable config files written at runtime.

Co-Authored-By: Puck Meerburg <puck@puck.moe>
Diffstat (limited to 'nixos/modules/services/networking/bird.nix')
-rw-r--r--nixos/modules/services/networking/bird.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/bird.nix b/nixos/modules/services/networking/bird.nix
index 4ae35875c0f..52ea3a40920 100644
--- a/nixos/modules/services/networking/bird.nix
+++ b/nixos/modules/services/networking/bird.nix
@@ -1,7 +1,7 @@
 { config, lib, pkgs, ... }:
 
 let
-  inherit (lib) mkEnableOption mkIf mkOption types;
+  inherit (lib) mkEnableOption mkIf mkOption optionalString types;
 
   generic = variant:
     let
@@ -26,6 +26,14 @@ let
               <link xlink:href='http://bird.network.cz/'/>
             '';
           };
+          checkConfig = mkOption {
+            type = types.bool;
+            default = true;
+            description = ''
+              Whether the config should be checked at build time.
+              Disabling this might become necessary if the config includes files not present during build time.
+            '';
+          };
         };
       };
 
@@ -36,7 +44,7 @@ let
         environment.etc."bird/${variant}.conf".source = pkgs.writeTextFile {
           name = "${variant}.conf";
           text = cfg.config;
-          checkPhase = ''
+          checkPhase = optionalString cfg.checkConfig ''
             ${pkg}/bin/${birdBin} -d -p -c $out
           '';
         };