From 1d6f590844ccf95acbe6dec567b7235e195f4334 Mon Sep 17 00:00:00 2001 From: Jinjing Wang Date: Fri, 12 Feb 2016 18:44:08 +0800 Subject: pdnsd: enable IPv6 by default --- pkgs/tools/networking/pdnsd/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/tools/networking/pdnsd/default.nix b/pkgs/tools/networking/pdnsd/default.nix index 40d57cd65b63..b1e7e92e815c 100644 --- a/pkgs/tools/networking/pdnsd/default.nix +++ b/pkgs/tools/networking/pdnsd/default.nix @@ -12,6 +12,8 @@ stdenv.mkDerivation rec { sed -i 's/.*(cachedir).*/:/' Makefile.in ''; + configureFlags = [ "--enable-ipv6" ]; + meta = { description = "Permanent DNS caching"; homepage = http://www.phys.uu.nl/~rombouts/pdnsd.html; -- cgit 1.4.1 From 73b9a9662df21ad7c1a372edfda403a8f4b529aa Mon Sep 17 00:00:00 2001 From: Jinjing Wang Date: Thu, 11 Feb 2016 19:02:11 +0800 Subject: pdnsd service: init --- lib/maintainers.nix | 1 + nixos/doc/manual/release-notes/rl-unstable.xml | 1 + nixos/modules/misc/ids.nix | 2 + nixos/modules/module-list.nix | 1 + nixos/modules/services/networking/pdnsd.nix | 93 ++++++++++++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 nixos/modules/services/networking/pdnsd.nix diff --git a/lib/maintainers.nix b/lib/maintainers.nix index 808d78d499de..934a58b0aab1 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -220,6 +220,7 @@ nathan-gs = "Nathan Bijnens "; nckx = "Tobias Geerinckx-Rice "; nequissimus = "Tim Steinbach "; + nfjinjing = "Jinjing Wang "; nico202 = "Nicolò Balzarotti "; notthemessiah = "Brian Cohen "; np = "Nicolas Pouillard "; diff --git a/nixos/doc/manual/release-notes/rl-unstable.xml b/nixos/doc/manual/release-notes/rl-unstable.xml index c814d61bcf4c..a4f25cdc51f5 100644 --- a/nixos/doc/manual/release-notes/rl-unstable.xml +++ b/nixos/doc/manual/release-notes/rl-unstable.xml @@ -41,6 +41,7 @@ nixos.path = ./nixpkgs-unstable-2015-12-06/nixos; services/monitoring/longview.nix + services/networking/pdnsd.nix services/web-apps/pump.io.nix services/security/haka.nix diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 064b4cbc4b33..29e269e3094e 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -248,6 +248,7 @@ matrix-synapse = 224; rspamd = 225; rmilter = 226; + pdnsd = 227; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! @@ -473,6 +474,7 @@ matrix-synapse = 224; rspamd = 225; rmilter = 226; + pdnsd = 227; # When adding a gid, make sure it doesn't match an existing # uid. Users and groups with the same name should have equal diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 0011544988d6..42de820951dc 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -340,6 +340,7 @@ ./services/networking/openntpd.nix ./services/networking/openvpn.nix ./services/networking/ostinato.nix + ./services/networking/pdnsd.nix ./services/networking/polipo.nix ./services/networking/prayer.nix ./services/networking/privoxy.nix diff --git a/nixos/modules/services/networking/pdnsd.nix b/nixos/modules/services/networking/pdnsd.nix new file mode 100644 index 000000000000..f4467b818958 --- /dev/null +++ b/nixos/modules/services/networking/pdnsd.nix @@ -0,0 +1,93 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.services.pdnsd; + pdnsd = pkgs.pdnsd; + pdnsdUser = "pdnsd"; + pdnsdGroup = "pdnsd"; + pdnsdConf = pkgs.writeText "pdnsd.conf" + '' + global { + run_as=${pdnsdUser}; + cache_dir="${cfg.cacheDir}"; + ${cfg.globalConfig} + } + + server { + ${cfg.serverConfig} + } + ${cfg.extraConfig} + ''; +in + +{ options = + { services.pdnsd = + { enable = mkEnableOption "pdnsd"; + + cacheDir = mkOption { + type = types.str; + default = "/var/cache/pdnsd"; + description = "Directory holding the pdnsd cache"; + }; + + globalConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Global configuration that should be added to the global directory + of pdnsd.conf. + ''; + }; + + serverConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Server configuration that should be added to the server directory + of pdnsd.conf. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra configuration directives that should be added to + pdnsd.conf. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + users.extraUsers = singleton { + name = pdnsdUser; + uid = config.ids.uids.pdnsd; + group = pdnsdGroup; + description = "pdnsd user"; + }; + + users.extraGroups = singleton { + name = pdnsdGroup; + gid = config.ids.gids.pdnsd; + }; + + systemd.services.pdnsd = + { wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + preStart = + '' + mkdir -p "${cfg.cacheDir}" + touch "${cfg.cacheDir}/pdnsd.cache" + chown -R ${pdnsdUser}:${pdnsdGroup} "${cfg.cacheDir}" + ''; + description = "pdnsd"; + serviceConfig = + { + ExecStart = "${pdnsd}/bin/pdnsd -c ${pdnsdConf}"; + }; + }; + }; +} -- cgit 1.4.1