From 15c8a4800e0b0d34f378806df01abf3d0f41de80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Fri, 26 Jun 2020 08:53:58 +0200 Subject: [PATCH 1/2] nsd: set passthru.tests --- pkgs/servers/dns/nsd/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/dns/nsd/default.nix b/pkgs/servers/dns/nsd/default.nix index 43c2900443e..67258f176be 100644 --- a/pkgs/servers/dns/nsd/default.nix +++ b/pkgs/servers/dns/nsd/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, libevent, openssl +{ stdenv, fetchurl, libevent, openssl, nixosTests , bind8Stats ? false , checking ? false , ipv6 ? true @@ -52,6 +52,10 @@ stdenv.mkDerivation rec { sed 's@$(INSTALL_DATA) nsd.conf.sample $(DESTDIR)$(nsdconfigfile).sample@@g' -i Makefile.in ''; + passthru.tests = { + inherit (nixosTests) nsd; + }; + meta = with stdenv.lib; { homepage = "http://www.nlnetlabs.nl"; description = "Authoritative only, high performance, simple and open source name server"; From 7020dc8eac0e709bd69779898106789ec96b4b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Thu, 25 Jun 2020 22:38:40 +0200 Subject: [PATCH 2/2] nixos/nsd: symlink conf file to /etc/nsd We remove the configFile build flag override in the NixOS module. Instead of embedding the conf file link to the binaries, we symlink it to /etc/nsd/nsd.nix, the hardcoded config file location for the various CLI nsd utilities. This config file build option override is triggerring a nsd rebuild for each configuration change. This prevent us to use the nixos cache in many cases. Co-authored-by: Erjo --- nixos/modules/services/networking/nsd.nix | 7 ++++--- pkgs/servers/dns/nsd/default.nix | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix index 6e3eed0c557..3ecbd06ee41 100644 --- a/nixos/modules/services/networking/nsd.nix +++ b/nixos/modules/services/networking/nsd.nix @@ -11,8 +11,6 @@ let # build nsd with the options needed for the given config nsdPkg = pkgs.nsd.override { - configFile = "${configFile}/nsd.conf"; - bind8Stats = cfg.bind8Stats; ipv6 = cfg.ipv6; ratelimit = cfg.ratelimit.enable; @@ -897,7 +895,10 @@ in + "want, please enable 'services.nsd.rootServer'."; }; - environment.systemPackages = [ nsdPkg ]; + environment = { + systemPackages = [ nsdPkg ]; + etc."nsd/nsd.conf".source = "${configFile}/nsd.conf"; + }; users.groups.${username}.gid = config.ids.gids.nsd; diff --git a/pkgs/servers/dns/nsd/default.nix b/pkgs/servers/dns/nsd/default.nix index 67258f176be..8d4125b8fa1 100644 --- a/pkgs/servers/dns/nsd/default.nix +++ b/pkgs/servers/dns/nsd/default.nix @@ -11,7 +11,7 @@ , rrtypes ? false , zoneStats ? false -, configFile ? "etc/nsd/nsd.conf" +, configFile ? "/etc/nsd/nsd.conf" }: stdenv.mkDerivation rec {