From 9accdbf60c7afd6479e7e5fb5fb933928c1fb981 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 6 Aug 2025 17:39:46 +0300 Subject: fix(machines/marduk): Fix slow SSH login --- machines/marduk/configuration.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/machines/marduk/configuration.nix b/machines/marduk/configuration.nix index ccae879..71fc1bf 100644 --- a/machines/marduk/configuration.nix +++ b/machines/marduk/configuration.nix @@ -13,7 +13,7 @@ }; }; - config = { + config = rec { constants = { # I've currently set this IP in my router configuration. # It would be better to write a proper static IP NixOS config, but its @@ -25,5 +25,23 @@ # work with it. tld = "int"; }; + + # This improves SSH speed via server.int + # The main problem is that when SSH-ing with server.int, the domain is + # queried, however DNS resolution doesn't happen through dnsmasq but + # through the nss hosts, which causes ~20 seconds of delay. + # Now we're first checking /etc/hosts and then the databases listed. + networking.hosts = { + ${constants.ip} = [ "server.int" ]; + }; + system.nssDatabases.hosts = lib.mkForce [ + "files" + "mymachines" + "mdns4_minimal" + "[NOTFOUND=return]" + "myhostname" + "dns" + "mdns4" + ]; }; } -- cgit v1.3.1-23-gd82d