diff options
author | Fabian Möller <fabianm88@gmail.com> | 2022-01-25 14:58:26 +0100 |
---|---|---|
committer | Fabian Möller <fabianm88@gmail.com> | 2022-01-25 14:58:26 +0100 |
commit | ba27a0aaeda1cde0f24853a2fa32fe4de4d0ed30 (patch) | |
tree | 5f5700dcb9ce568ea0779c2448a00f9296546022 /nixos | |
parent | 69206b97e987734edc681c4ce8df74d47c5a2a8c (diff) |
nixos/bird: add option to modify config check environment
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/bird.nix | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/bird.nix b/nixos/modules/services/networking/bird.nix index c14adbda3c5ac..fc06cdaa6e58c 100644 --- a/nixos/modules/services/networking/bird.nix +++ b/nixos/modules/services/networking/bird.nix @@ -31,7 +31,23 @@ let 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. + When the config can't be checked during build time, for example when it includes + other files, either disable this option or use <code>preCheckConfig</code> to create + the included files before checking. + ''; + }; + preCheckConfig = mkOption { + type = types.lines; + default = ""; + example = '' + echo "cost 100;" > include.conf + ''; + description = '' + Commands to execute before the config file check. The file to be checked will be + available as <code>${variant}.conf</code> in the current directory. + + Files created with this option will not be available at service runtime, only during + build time checking. ''; }; }; @@ -45,7 +61,9 @@ let name = "${variant}.conf"; text = cfg.config; checkPhase = optionalString cfg.checkConfig '' - ${pkg}/bin/${birdBin} -d -p -c $out + ln -s $out ${variant}.conf + ${cfg.preCheckConfig} + ${pkg}/bin/${birdBin} -d -p -c ${variant}.conf ''; }; |