From d4bb4e7ad9b08f8086520857323a46cb732e1848 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Mon, 7 Aug 2023 15:02:42 -0700 Subject: [PATCH 1/3] Make MagicDNS fully qualified hostnames work --- hosts/desktop.nix | 3 ++- hosts/elnudrop/modules/headscale.nix | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hosts/desktop.nix b/hosts/desktop.nix index de98c63..17016a5 100644 --- a/hosts/desktop.nix +++ b/hosts/desktop.nix @@ -34,7 +34,6 @@ in networking = { networkmanager.enable = true; - resolvconf.enable = false; # prevent default nameservers nameservers = [ "1.1.1.1" "1.0.0.1" ]; }; @@ -57,6 +56,8 @@ in # To prevent `Unit dconf.service not found.` after theming GTK in HM programs.dconf.enable = true; + networking.search = [ "elnu.com" ]; + networking.extraHosts = '' 192.168.0.26 elnuhub 192.168.0.26 elnuhub.local diff --git a/hosts/elnudrop/modules/headscale.nix b/hosts/elnudrop/modules/headscale.nix index 909f233..6463a0f 100644 --- a/hosts/elnudrop/modules/headscale.nix +++ b/hosts/elnudrop/modules/headscale.nix @@ -10,7 +10,10 @@ in { port = 8080; settings = { server_url = "https://${domain}"; - dns_config.base_domain = baseDomain; + dns_config = { + base_domain = baseDomain; + domains = [ baseDomain ]; + }; }; }; environment.systemPackages = [ config.services.headscale.package ]; From 91a3b262c50eb452d5ec9488c31b15daeaf24d67 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Mon, 7 Aug 2023 17:01:35 -0700 Subject: [PATCH 2/3] Use MagicDNS --- hosts/desktop.nix | 11 ++++------- hosts/elnudrop/hosts/jichan.org/default.nix | 7 +++---- hosts/elnudrop/hosts/tegakituesday.com/default.nix | 2 +- modules/tailscale/default.nix | 10 ---------- 4 files changed, 8 insertions(+), 22 deletions(-) delete mode 100644 modules/tailscale/default.nix diff --git a/hosts/desktop.nix b/hosts/desktop.nix index 17016a5..c11e33d 100644 --- a/hosts/desktop.nix +++ b/hosts/desktop.nix @@ -58,13 +58,10 @@ in networking.search = [ "elnu.com" ]; - networking.extraHosts = '' - 192.168.0.26 elnuhub - 192.168.0.26 elnuhub.local - 24.199.72.8 elnudrop - 24.199.72.8 elnudrop.local - ${tailscale.hosts} - ''; + networking.hosts = { + "192.168.0.26" = [ "elnuhub.local" ]; + "24.199.72.8" = [ "elnudrop.local" ]; + }; #sound.enable = true; #hardware.pulseaudio.enable = true; diff --git a/hosts/elnudrop/hosts/jichan.org/default.nix b/hosts/elnudrop/hosts/jichan.org/default.nix index 9c16b7a..372a65a 100644 --- a/hosts/elnudrop/hosts/jichan.org/default.nix +++ b/hosts/elnudrop/hosts/jichan.org/default.nix @@ -1,4 +1,3 @@ -with import ../../../../modules/tailscale/default.nix; let host = "jichan.org"; in { services.nginx.virtualHosts."www.${host}" = { forceSSL = true; @@ -12,7 +11,7 @@ let host = "jichan.org"; in { error_page 502 /502.html; ''; locations = { - "/".proxyPass = "http://${elnuhub}:3334"; + "/".proxyPass = "http://elnuhub:3334"; "/502.html".root = "${./502}"; "/logo.svg".root = "${./502}"; "/missing.min.css".root = "${../shared/502}"; @@ -20,7 +19,7 @@ let host = "jichan.org"; in { # Formerly tatoeba.elnu.com # https://git.elnu.com/ElnuDev/tatoeba-api "/api/tatoeba/" = { - proxyPass = "http://${elnuhub}:3001"; + proxyPass = "http://elnuhub:3001"; extraConfig = '' rewrite ^/api/tatoeba/(.*) /$1 break; ''; @@ -29,7 +28,7 @@ let host = "jichan.org"; in { # Formerly images.elnu.com # https://git.elnu.com/ElnuDev/image-api "/api/images/" = { - proxyPass = "http://${elnuhub}:3002"; + proxyPass = "http://elnuhub:3002"; extraConfig = '' rewrite ^/api/images/(.*) /$1 break; ''; diff --git a/hosts/elnudrop/hosts/tegakituesday.com/default.nix b/hosts/elnudrop/hosts/tegakituesday.com/default.nix index 91e5c7a..64d256c 100644 --- a/hosts/elnudrop/hosts/tegakituesday.com/default.nix +++ b/hosts/elnudrop/hosts/tegakituesday.com/default.nix @@ -12,7 +12,7 @@ let host = "tegakituesday.com"; in { error_page 502 /502.html; ''; locations = { - "/".proxyPass = "http://${elnuhub}:3335"; + "/".proxyPass = "http://elnuhub:3335"; "/502.html".root = "${./502}"; "/mascot.png".root = "${./502}"; "/missing.min.css".root = "${../shared/502}"; diff --git a/modules/tailscale/default.nix b/modules/tailscale/default.nix deleted file mode 100644 index a7ffce8..0000000 --- a/modules/tailscale/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -rec { - elnu = "100.64.0.1"; - elnudrop = "100.64.0.2"; - elnuhub = "100.64.0.3"; - hosts = '' - ${elnu} elnu.elnu.com - ${elnudrop} elnudrop.elnu.com - ${elnuhub} elnuhub.elnu.com - ''; -} \ No newline at end of file From 793eec3ec42179da5618d7637e29ed0e5081baf2 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Mon, 7 Aug 2023 19:23:38 -0700 Subject: [PATCH 3/3] Remove unnecessary assignment to networking.search --- hosts/desktop.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/hosts/desktop.nix b/hosts/desktop.nix index c11e33d..6f5152c 100644 --- a/hosts/desktop.nix +++ b/hosts/desktop.nix @@ -56,8 +56,6 @@ in # To prevent `Unit dconf.service not found.` after theming GTK in HM programs.dconf.enable = true; - networking.search = [ "elnu.com" ]; - networking.hosts = { "192.168.0.26" = [ "elnuhub.local" ]; "24.199.72.8" = [ "elnudrop.local" ];