From a5d2eced839fb8501f5c62e7045cf0f2536c051f Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 2 Oct 2026 00:31:34 +0200 Subject: tests/default: Allow adding stuff to the default dns config --- tests/default.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'tests/default.nix') diff --git a/tests/default.nix b/tests/default.nix index b9c3cbd..b679dc1 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -19,6 +19,18 @@ name, # Node definition, like in a normal nixos vm test. nodes ? {}, + # Extra DNS configuration with the node's config as input. + # Example: + # ``` + # server1 = {config, ...}: { + # "domain.example.org" = { + # TXT = [ "test" ]; + # }; + # }; + # ``` + # That will add the TXT record to the `domain.example.org` domain, the `config` will + # be from the `server1` node. + dns ? {}, # Server domains that all clients and the server can resolve via dns. # The format follows the common one, e.g.: # `{nodeName = "domain.example.com";}` @@ -37,7 +49,7 @@ # Apparently the default's (e.g. `serivces ? []`), are not applied for the `@args` # syntax. args = { - inherit name nodes serverDomains testScript services ignore; + inherit name dns nodes serverDomains testScript services ignore; }; in specialArgs.nixos-lib.runTest { @@ -102,6 +114,15 @@ builtins.listToAttrs (builtins.map mkDomain args.serverDomains); }; } + + (pkgs.lib.mapAttrs' (nodeName: dnsOverride: { + name = "name_server"; + value = {nodes, ...}: { + vhack.dns.zones = dnsOverride {config = nodes."${nodeName}";}; + }; + }) + args.dns) + args.nodes (builtins.mapAttrs (_: _: { imports = [ -- cgit v1.3.1