git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/bird: add option to modify config check environment
commitba27a0aaeda1cde0f24853a2fa32fe4de4d0ed30 authorFabian Möller <fabianm88@gmail.com> dateTue 25 Jan 2022, 14:58 (5 years ago) parent69206b9
1 file changed+20−2
nixos/modules/services/networking/bird.nix+20−2
nixos/modules/services/networking/bird.nix+20−2
@@ -31,7 +31,23 @@ let
3131 default = true;
3232 description = ''
3333 Whether the config should be checked at build time.
34− Disabling this might become necessary if the config includes files not present during build time.
34+ When the config can't be checked during build time, for example when it includes
35+ other files, either disable this option or use <code>preCheckConfig</code> to create
36+ the included files before checking.
37+ '';
38+ };
39+ preCheckConfig = mkOption {
40+ type = types.lines;
41+ default = "";
42+ example = ''
43+ echo "cost 100;" > include.conf
44+ '';
45+ description = ''
46+ Commands to execute before the config file check. The file to be checked will be
47+ available as <code>${variant}.conf</code> in the current directory.
48+
49+ Files created with this option will not be available at service runtime, only during
50+ build time checking.
3551 '';
3652 };
3753 };
@@ -45,7 +61,9 @@ let
4561 name = "${variant}.conf";
4662 text = cfg.config;
4763 checkPhase = optionalString cfg.checkConfig ''
48− ${pkg}/bin/${birdBin} -d -p -c $out
64+ ln -s $out ${variant}.conf
65+ ${cfg.preCheckConfig}
66+ ${pkg}/bin/${birdBin} -d -p -c ${variant}.conf
4967 '';
5068 };
5169