Convert "bind"

svn path=/nixos/branches/fix-style/; revision=14394
This commit is contained in:
Marc Weber 2009-03-06 12:27:13 +00:00
parent a0b0bba762
commit c0ed553c87
3 changed files with 69 additions and 53 deletions

View file

@ -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 = {
@ -619,6 +583,7 @@ in
(import ../upstart-jobs/openfire.nix)
(import ../upstart-jobs/postfix.nix)
(import ../upstart-jobs/dovecot.nix)
(import ../upstart-jobs/bind.nix)
# nix
(import ../upstart-jobs/nix.nix) # nix options and daemon

View file

@ -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
startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";
cfg = config.services.bind;
@ -52,15 +100,24 @@ let
confFile = pkgs.writeText "named.conf" namedConf;
in
{
name = "bind";
job = ''
description "BIND name server job"
start script
${pkgs.coreutils}/bin/mkdir -p /var/run/named
end script
mkIf config.services.bind.enable {
require = [
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
'';
}];
};
}

View file

@ -131,12 +131,6 @@ let
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.
++ (map
(event: makeJob (import ../upstart-jobs/halt.nix {