Convert "bind"
svn path=/nixos/branches/fix-style/; revision=14394
This commit is contained in:
parent
a0b0bba762
commit
c0ed553c87
@ -479,42 +479,6 @@ in
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bind = {
|
|
||||||
enable = mkOption {
|
|
||||||
default = false;
|
|
||||||
description = "
|
|
||||||
Whether to enable BIND domain name server.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
cacheNetworks = mkOption {
|
|
||||||
default = ["127.0.0.0/24"];
|
|
||||||
description = "
|
|
||||||
What networks are allowed to use us as a resolver.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
blockedNetworks = mkOption {
|
|
||||||
default = [];
|
|
||||||
description = "
|
|
||||||
What networks are just blocked.
|
|
||||||
";
|
|
||||||
};
|
|
||||||
zones = mkOption {
|
|
||||||
default = [];
|
|
||||||
description = "
|
|
||||||
List of zones we claim authority over.
|
|
||||||
master=false means slave server; slaves means addresses
|
|
||||||
who may request zone transfer.
|
|
||||||
";
|
|
||||||
example = [{
|
|
||||||
name = "example.com";
|
|
||||||
master = false;
|
|
||||||
file = "/var/dns/example.com";
|
|
||||||
masters = ["192.168.0.1"];
|
|
||||||
slaves = [];
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nesting = {
|
nesting = {
|
||||||
@ -619,6 +583,7 @@ in
|
|||||||
(import ../upstart-jobs/openfire.nix)
|
(import ../upstart-jobs/openfire.nix)
|
||||||
(import ../upstart-jobs/postfix.nix)
|
(import ../upstart-jobs/postfix.nix)
|
||||||
(import ../upstart-jobs/dovecot.nix)
|
(import ../upstart-jobs/dovecot.nix)
|
||||||
|
(import ../upstart-jobs/bind.nix)
|
||||||
|
|
||||||
# nix
|
# nix
|
||||||
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
||||||
|
@ -1,4 +1,52 @@
|
|||||||
{config, pkgs}:
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
services = {
|
||||||
|
bind = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "
|
||||||
|
Whether to enable BIND domain name server.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
cacheNetworks = mkOption {
|
||||||
|
default = ["127.0.0.0/24"];
|
||||||
|
description = "
|
||||||
|
What networks are allowed to use us as a resolver.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
blockedNetworks = mkOption {
|
||||||
|
default = [];
|
||||||
|
description = "
|
||||||
|
What networks are just blocked.
|
||||||
|
";
|
||||||
|
};
|
||||||
|
zones = mkOption {
|
||||||
|
default = [];
|
||||||
|
description = "
|
||||||
|
List of zones we claim authority over.
|
||||||
|
master=false means slave server; slaves means addresses
|
||||||
|
who may request zone transfer.
|
||||||
|
";
|
||||||
|
example = [{
|
||||||
|
name = "example.com";
|
||||||
|
master = false;
|
||||||
|
file = "/var/dns/example.com";
|
||||||
|
masters = ["192.168.0.1"];
|
||||||
|
slaves = [];
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
let
|
let
|
||||||
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";
|
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";
|
||||||
cfg = config.services.bind;
|
cfg = config.services.bind;
|
||||||
@ -52,15 +100,24 @@ let
|
|||||||
confFile = pkgs.writeText "named.conf" namedConf;
|
confFile = pkgs.writeText "named.conf" namedConf;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
|
||||||
name = "bind";
|
|
||||||
job = ''
|
|
||||||
description "BIND name server job"
|
|
||||||
|
|
||||||
start script
|
mkIf config.services.bind.enable {
|
||||||
${pkgs.coreutils}/bin/mkdir -p /var/run/named
|
require = [
|
||||||
end script
|
options
|
||||||
|
];
|
||||||
|
|
||||||
respawn ${pkgs.bind}/sbin/named -c ${confFile} -f
|
services = {
|
||||||
'';
|
extraJobs = [{
|
||||||
}
|
name = "bind";
|
||||||
|
job = ''
|
||||||
|
description "BIND name server job"
|
||||||
|
|
||||||
|
start script
|
||||||
|
${pkgs.coreutils}/bin/mkdir -p /var/run/named
|
||||||
|
end script
|
||||||
|
|
||||||
|
respawn ${pkgs.bind}/sbin/named -c ${confFile} -f
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -131,12 +131,6 @@ let
|
|||||||
inherit config;
|
inherit config;
|
||||||
})
|
})
|
||||||
|
|
||||||
# ISC BIND domain name server.
|
|
||||||
++ optional config.services.bind.enable
|
|
||||||
(import ../upstart-jobs/bind.nix {
|
|
||||||
inherit config pkgs;
|
|
||||||
})
|
|
||||||
|
|
||||||
# Handles the reboot/halt events.
|
# Handles the reboot/halt events.
|
||||||
++ (map
|
++ (map
|
||||||
(event: makeJob (import ../upstart-jobs/halt.nix {
|
(event: makeJob (import ../upstart-jobs/halt.nix {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user