Merge pull request #116743 from flokli/bird-check-config-disable
nixos/bird*: enable config files outside the store, propagate reload errors to systemd
This commit is contained in:
commit
f3fa3a38a9
1 changed files with 11 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkIf mkOption types;
|
inherit (lib) mkEnableOption mkIf mkOption optionalString types;
|
||||||
|
|
||||||
generic = variant:
|
generic = variant:
|
||||||
let
|
let
|
||||||
|
@ -26,6 +26,14 @@ let
|
||||||
<link xlink:href='http://bird.network.cz/'/>
|
<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 {
|
environment.etc."bird/${variant}.conf".source = pkgs.writeTextFile {
|
||||||
name = "${variant}.conf";
|
name = "${variant}.conf";
|
||||||
text = cfg.config;
|
text = cfg.config;
|
||||||
checkPhase = ''
|
checkPhase = optionalString cfg.checkConfig ''
|
||||||
${pkg}/bin/${birdBin} -d -p -c $out
|
${pkg}/bin/${birdBin} -d -p -c $out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -50,7 +58,7 @@ let
|
||||||
Type = "forking";
|
Type = "forking";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
ExecStart = "${pkg}/bin/${birdBin} -c /etc/bird/${variant}.conf -u ${variant} -g ${variant}";
|
ExecStart = "${pkg}/bin/${birdBin} -c /etc/bird/${variant}.conf -u ${variant} -g ${variant}";
|
||||||
ExecReload = "${pkg}/bin/${birdc} configure";
|
ExecReload = "/bin/sh -c '${pkg}/bin/${birdBin} -c /etc/bird/${variant}.conf -p && ${pkg}/bin/${birdc} configure'";
|
||||||
ExecStop = "${pkg}/bin/${birdc} down";
|
ExecStop = "${pkg}/bin/${birdc} down";
|
||||||
CapabilityBoundingSet = [ "CAP_CHOWN" "CAP_FOWNER" "CAP_DAC_OVERRIDE" "CAP_SETUID" "CAP_SETGID"
|
CapabilityBoundingSet = [ "CAP_CHOWN" "CAP_FOWNER" "CAP_DAC_OVERRIDE" "CAP_SETUID" "CAP_SETGID"
|
||||||
# see bird/sysdep/linux/syspriv.h
|
# see bird/sysdep/linux/syspriv.h
|
||||||
|
|
Loading…
Reference in a new issue