From dd8867b52f5061aa63a9ce1c3140691ee27cc277 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:06:35 +0000 Subject: [PATCH] feat: add sovran_systemsOS.caddy.extraVirtualHosts NixOS option Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/e966dd20-b74e-4ec5-b4db-68aa06129162 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- custom.template.nix | 16 ++++++++++++++++ modules/core/caddy.nix | 6 ++++++ modules/core/roles.nix | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/custom.template.nix b/custom.template.nix index 81b0016..70ee7f1 100644 --- a/custom.template.nix +++ b/custom.template.nix @@ -22,4 +22,20 @@ # ─── Add your custom NixOS configuration below ─────────── + # ─── Custom Caddy virtual hosts ────────────────────────── + # Uncomment and edit below to add your own Caddy sites: + # + # sovran_systemsOS.caddy.extraVirtualHosts = '' + # mysite.example.com { + # encode gzip zstd + # root * /var/lib/www/mysite + # php_fastcgi unix//run/phpfpm/mypool.sock + # file_server browse + # } + # + # anotherdomain.com { + # reverse_proxy localhost:9090 + # } + # ''; + } \ No newline at end of file diff --git a/modules/core/caddy.nix b/modules/core/caddy.nix index 7f4d811..15b0cba 100755 --- a/modules/core/caddy.nix +++ b/modules/core/caddy.nix @@ -2,6 +2,7 @@ let exposeBtcpay = config.sovran_systemsOS.web.btcpayserver; + extraVhosts = config.sovran_systemsOS.caddy.extraVirtualHosts; in { services.caddy = { @@ -170,6 +171,11 @@ EOF encode gzip zstd } EOF + + # ── Custom vhosts from custom.nix ────────────── + cat >> /run/caddy/Caddyfile <<'CUSTOM_VHOSTS_EOF' +${extraVhosts} +CUSTOM_VHOSTS_EOF ''; }; } diff --git a/modules/core/roles.nix b/modules/core/roles.nix index 2de80d5..95d5a2e 100755 --- a/modules/core/roles.nix +++ b/modules/core/roles.nix @@ -60,6 +60,15 @@ }; }; + # ── Caddy customisation ─────────────────────────────────── + caddy = { + extraVirtualHosts = lib.mkOption { + type = lib.types.lines; + default = ""; + description = "Additional raw Caddyfile blocks appended to the generated Caddy config. Use this in custom.nix to add custom domains and reverse proxies."; + }; + }; + # ── Domain setup registry ───────────────────────────────── domainRequirements = lib.mkOption { type = lib.types.listOf (lib.types.submodule {