diff options
author | Matt Christ <matt@christ.systems> | 2021-07-11 08:11:33 -0500 |
---|---|---|
committer | Matt Christ <matt@christ.systems> | 2021-07-11 08:11:33 -0500 |
commit | 0ce72580be10f8d8ce66ee67ddb5b4932c70cb29 (patch) | |
tree | bdc8a51b9e3aae7b44c43a054e3c4381a685a0c2 /nixos | |
parent | 15ddd8316a81c32b55b318ea69c97505d27e793b (diff) |
nixos/bind: allow specifying BIND package
This allows users of the bind module to specify an alternate BIND package. For example, by overriding the source attribute to use a different version of BIND. Since the default value for `services.bind.package` is `pkgs.bind`, this change is completely backwards compatible with the current module.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/bind.nix | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix index 20eef2c3455b6..33da4071638ef 100644 --- a/nixos/modules/services/networking/bind.nix +++ b/nixos/modules/services/networking/bind.nix @@ -6,6 +6,8 @@ let cfg = config.services.bind; + bindPkg = config.services.bind.package; + bindUser = "named"; bindZoneCoerce = list: builtins.listToAttrs (lib.forEach list (zone: { name = zone.name; value = zone; })); @@ -104,6 +106,14 @@ in enable = mkEnableOption "BIND domain name server"; + + package = mkOption { + type = types.package; + default = pkgs.bind; + defaultText = "pkgs.bind"; + description = "The BIND package to use."; + }; + cacheNetworks = mkOption { default = [ "127.0.0.0/24" ]; type = types.listOf types.str; @@ -225,7 +235,7 @@ in preStart = '' mkdir -m 0755 -p /etc/bind if ! [ -f "/etc/bind/rndc.key" ]; then - ${pkgs.bind.out}/sbin/rndc-confgen -c /etc/bind/rndc.key -u ${bindUser} -a -A hmac-sha256 2>/dev/null + ${bindPkg.out}/sbin/rndc-confgen -c /etc/bind/rndc.key -u ${bindUser} -a -A hmac-sha256 2>/dev/null fi ${pkgs.coreutils}/bin/mkdir -p /run/named @@ -233,9 +243,9 @@ in ''; serviceConfig = { - ExecStart = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f"; - ExecReload = "${pkgs.bind.out}/sbin/rndc -k '/etc/bind/rndc.key' reload"; - ExecStop = "${pkgs.bind.out}/sbin/rndc -k '/etc/bind/rndc.key' stop"; + ExecStart = "${bindPkg.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f"; + ExecReload = "${bindPkg.out}/sbin/rndc -k '/etc/bind/rndc.key' reload"; + ExecStop = "${bindPkg.out}/sbin/rndc -k '/etc/bind/rndc.key' stop"; }; unitConfig.Documentation = "man:named(8)"; |