git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #74032 from ckauhaus/remove-networking.hostconf

Remove networking.hostConf option

commitea9c3b934265d12129c0ec6ead48fabd87c0c050 authorFlorian Klink <flokli@flokli.de> dateThu 5 Dec 2019, 21:42 (7 years ago) parent47a87468d36536
3 files changed+50−14
nixos/modules/config/networking.nix+3−14 nixos/modules/rename.nix+1 nixos/tests/resolv.nix+46
nixos/modules/config/networking.nix+3−14
@@ -41,19 +41,6 @@ in
4141 '';
4242 };
4343
44− networking.hostConf = lib.mkOption {
45− type = types.lines;
46− default = "multi on";
47− example = ''
48− multi on
49− reorder on
50− trim lan
51− '';
52− description = ''
53− The contents of <filename>/etc/host.conf</filename>. See also <citerefentry><refentrytitle>host.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
54− '';
55− };
56−
5744 networking.timeServers = mkOption {
5845 default = [
5946 "0.nixos.pool.ntp.org"
@@ -186,7 +173,9 @@ in
186173 '';
187174
188175 # /etc/host.conf: resolver configuration file
189− "host.conf".text = cfg.hostConf;
176+ "host.conf".text = ''
177+ multi on
178+ '';
190179
191180 } // optionalAttrs (pkgs.stdenv.hostPlatform.libc == "glibc") {
192181 # /etc/rpc: RPC program numbers.
nixos/modules/rename.nix+1
@@ -239,6 +239,7 @@ with lib;
239239 (mkRemovedOptionModule [ "systemd" "generator-packages" ] "Use systemd.packages instead.")
240240 (mkRemovedOptionModule [ "fonts" "enableCoreFonts" ] "Use fonts.fonts = [ pkgs.corefonts ]; instead.")
241241 (mkRemovedOptionModule [ "networking" "vpnc" ] "Use environment.etc.\"vpnc/service.conf\" instead.")
242+ (mkRemovedOptionModule [ "networking" "hostConf" ] "Use environment.etc.\"host.conf\" instead.")
242243
243244 # ZSH
244245 (mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])
nixos/tests/resolv.nixnew file+46
@@ -0,0 +1,46 @@
1+# Test whether DNS resolving returns multiple records and all address families.
2+import ./make-test-python.nix ({ pkgs, ... } : {
3+ name = "resolv";
4+ meta = with pkgs.stdenv.lib.maintainers; {
5+ maintainers = [ ckauhaus ];
6+ };
7+
8+ nodes.resolv = { ... }: {
9+ networking.extraHosts = ''
10+ # IPv4 only
11+ 192.0.2.1 host-ipv4.example.net
12+ 192.0.2.2 host-ipv4.example.net
13+ # IP6 only
14+ 2001:db8::2:1 host-ipv6.example.net
15+ 2001:db8::2:2 host-ipv6.example.net
16+ # dual stack
17+ 192.0.2.1 host-dual.example.net
18+ 192.0.2.2 host-dual.example.net
19+ 2001:db8::2:1 host-dual.example.net
20+ 2001:db8::2:2 host-dual.example.net
21+ '';
22+ };
23+
24+ testScript = ''
25+ def addrs_in(hostname, addrs):
26+ res = resolv.succeed("getent ahosts {}".format(hostname))
27+ for addr in addrs:
28+ assert addr in res, "Expected output '{}' not found in\n{}".format(addr, res)
29+
30+
31+ start_all()
32+ resolv.wait_for_unit("nscd")
33+
34+ ipv4 = ["192.0.2.1", "192.0.2.2"]
35+ ipv6 = ["2001:db8::2:1", "2001:db8::2:2"]
36+
37+ with subtest("IPv4 resolves"):
38+ addrs_in("host-ipv4.example.net", ipv4)
39+
40+ with subtest("IPv6 resolves"):
41+ addrs_in("host-ipv6.example.net", ipv6)
42+
43+ with subtest("Dual stack resolves"):
44+ addrs_in("host-dual.example.net", ipv4 + ipv6)
45+ '';
46+})