From 3bfa7ebba8f93efd9343dd91ab1d7e0d56ef1170 Mon Sep 17 00:00:00 2001 From: prescientmoon Date: Mon, 3 Mar 2025 23:26:00 +0100 Subject: [PATCH] Fix website dns stuff --- dns/implementation/nixos-module.nix | 1 + flake.lock | 58 +++++++++++++++++++++-- hosts/nixos/lapetus/default.nix | 2 +- hosts/nixos/lapetus/services/moonythm.nix | 1 - modules/nixos/cloudflared.nix | 4 +- 5 files changed, 59 insertions(+), 7 deletions(-) diff --git a/dns/implementation/nixos-module.nix b/dns/implementation/nixos-module.nix index d9afce8..5f49fda 100644 --- a/dns/implementation/nixos-module.nix +++ b/dns/implementation/nixos-module.nix @@ -41,6 +41,7 @@ in "TXT" "CNAME" "MX" + "ALIAS" ]; description = "The type of the DNS record"; }; diff --git a/flake.lock b/flake.lock index d567e75..7431911 100644 --- a/flake.lock +++ b/flake.lock @@ -611,6 +611,24 @@ } }, "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -631,7 +649,7 @@ "type": "github" } }, - "flake-parts_4": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -1025,7 +1043,7 @@ }, "hercules-ci-effects": { "inputs": { - "flake-parts": "flake-parts_4", + "flake-parts": "flake-parts_5", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -1290,10 +1308,31 @@ "type": "github" } }, + "moonythm": { + "inputs": { + "flake-parts": "flake-parts_3", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1741037664, + "narHash": "sha256-1XnBCxVwI+ma9bMkcTxXvk2dp1EUeN0Wi4ey/K/fGCc=", + "ref": "refs/heads/main", + "rev": "ff605ada27e33b6150af94f3d402afe69e67d3b9", + "revCount": 23, + "type": "git", + "url": "ssh://forgejo@ssh.git.moonythm.dev/prescientmoon/moonythm.git" + }, + "original": { + "type": "git", + "url": "ssh://forgejo@ssh.git.moonythm.dev/prescientmoon/moonythm.git" + } + }, "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat_4", - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "git-hooks": "git-hooks", "hercules-ci-effects": "hercules-ci-effects", "neovim-src": "neovim-src", @@ -1404,6 +1443,18 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1727825735, + "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1718811006, @@ -1887,6 +1938,7 @@ "intray": "intray", "korora": "korora", "miros": "miros", + "moonythm": "moonythm", "neovim-nightly-overlay": "neovim-nightly-overlay", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", diff --git a/hosts/nixos/lapetus/default.nix b/hosts/nixos/lapetus/default.nix index d331d91..b396da9 100644 --- a/hosts/nixos/lapetus/default.nix +++ b/hosts/nixos/lapetus/default.nix @@ -29,7 +29,7 @@ ./services/jellyfin.nix ./services/jupyter.nix ./services/microbin.nix - ./services/moonythm.nix.nix + ./services/moonythm.nix ./services/pounce.nix ./services/prometheus.nix ./services/prometheus.nix diff --git a/hosts/nixos/lapetus/services/moonythm.nix b/hosts/nixos/lapetus/services/moonythm.nix index 6d7374d..619f5bf 100644 --- a/hosts/nixos/lapetus/services/moonythm.nix +++ b/hosts/nixos/lapetus/services/moonythm.nix @@ -9,7 +9,6 @@ in { satellite.cloudflared.at."".port = 8080; - satellite.nginx.at."".files = dir; services.nginx.virtualHosts."".extraConfig = '' root ${dir}; error_page 404 /404.html; diff --git a/modules/nixos/cloudflared.nix b/modules/nixos/cloudflared.nix index ab0b424..4f460e7 100644 --- a/modules/nixos/cloudflared.nix +++ b/modules/nixos/cloudflared.nix @@ -40,7 +40,7 @@ in host = lib.mkOption { description = "Host to direct traffic from"; type = lib.types.str; - default = "${config.subdomain}.${cfg.domain}"; + default = if config.subdomain == "" then cfg.domain else "${config.subdomain}.${cfg.domain}"; }; protocol = lib.mkOption { @@ -81,7 +81,7 @@ in mkDnsRecord = { subdomain, ... }: { - type = "CNAME"; + type = if subdomain == "" then "ALIAS" else "CNAME"; at = subdomain; zone = cfg.domain; value = "${cfg.tunnel}.cfargotunnel.com.";