dns.nix icon indicating copy to clipboard operation
dns.nix copied to clipboard

Use of `dns.nix` triggers infinite recursion

Open Kreyren opened this issue 3 years ago • 5 comments

I've deployed dns.nix in my config, but this line https://git.dotya.ml/RiXotStudio/system-management/src/branch/central/services/named/bind.nix#L11 causes an infinite recursion that community support in nix's matrix channel suspect is coming from dns.nix

Log: http://ix.io/3sbs

Kreyren avatar Jul 08 '21 17:07 Kreyren

CC @kirelagin

Kreyren avatar Jul 08 '21 17:07 Kreyren

Removing

subdomains = rec {
		ns = host "213.220.221.43";
	};	

from:

# File integrating https://github.com/kirelagin/dns.nix

{ dns, ... }: with dns.lib.combinators; {
	SOA = {
		# DND(Krey): Integrate `config.networking.fqdn`
		nameServer = "ns.leonid.rixotstudio.cz";
		# FIXME(Krey): Import this domain-wide
		adminEmail = "[email protected]";
		# FIXME(Krey): Generate this YYMMDDHH
		serial = 0;
	};

	NS = [ "ns.leonid.rixotstudio.cz" ];

	# FIXME-QA(Krey): Handle the interface
	# FIXME-QA(Krey): Figure out how to use `networking.interfaces.enp7s0.ipv4.addresses`
	A = [
		{ address = "SYSTEM_IP"; }
	];

	# FIXME(Krey): Integrate logic to set AAAA record
	# AAAA [
	# 	"${networking.interfaces.enp7s0.ipv6.addresses}"
	# ];

	subdomains = rec {
		ns = host "SYSTEM_IP";
	};	
}

With SYSTEM_IP representing IPv4 of the system fixed the issue

Kreyren avatar Jul 08 '21 18:07 Kreyren

The problem here is that host takes two arguments: IPv4 and IPv6. So, in your example it should be ns = host "SYSTEM_IP" null;.

The fact that it causes infinite recursion, though, is weird, so I’ll reopen this.

kirelagin avatar Jul 08 '21 18:07 kirelagin

The fact that it causes infinite recursion, though, is weird, so I’ll reopen this. -- @kirelagin

Were you able to reproduce the issue?

Kreyren avatar Jul 09 '21 02:07 Kreyren

Yes, I reproduced it using the zone from your original comment, but it can also be done by removing the second argument of host in the example.nix file in this repository, like so:

diff --git a/example.nix b/example.nix
index 4817f63..f7481b0 100644
--- a/example.nix
+++ b/example.nix
@@ -48,8 +48,8 @@ let
 
     subdomains = rec {
       www.A = [ "203.0.113.4" ];
-      www2 = host "203.0.113.5" "4321:0:1:2:3:4:567:89bb";
-      www3 = host "203.0.113.6" null;
+      www2 = host "203.0.113.5";
+      www3 = host "203.0.113.6";
       www4 = www3;
 
       staging = delegateTo [

which results in:

error: infinite recursion encountered

       at /nix/store/3ghy6irqjf72xmvzvi7j5amy6qp1b347-source/lib/modules.nix:568:27:

          567|     optionalValue =
          568|       if isDefined then { value = mergedValue; }
             |                           ^
          569|       else {};
(use '--show-trace' to show detailed location information)

kirelagin avatar Jul 09 '21 19:07 kirelagin