From e81f6643fcdea18e345f138416add07b77d942b1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Jul 2026 23:35:30 +0000 Subject: [PATCH] fix: desktop-only safety fixes (nix-bitcoin compat, mkForce, conditional caddy) 1. Add nix-bitcoin.generateSecrets = lib.mkDefault true global compat default in role-logic.nix so Desktop Only systems can evaluate while nix-bitcoin is still globally imported by the flake. 2. Harden Desktop Only role: change all server/node service and feature disables from lib.mkDefault false to lib.mkForce false so they cannot be overridden by custom.nix or option defaults. - sovran_systemsOS.services: synapse, bitcoin, vaultwarden, wordpress, nextcloud - sovran_systemsOS.features: haven, mempool, element-calling, bitcoin-core - sovran_systemsOS.web.btcpayserver 3. Make Caddy conditional in caddy.nix: enable = needsHttpsPorts || extraVhosts != "" so Caddy does not run on Desktop Only installs with no web services. --- modules/core/caddy.nix | 5 ++++- modules/core/role-logic.nix | 28 ++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/modules/core/caddy.nix b/modules/core/caddy.nix index 9ea7bdf..9017352 100755 --- a/modules/core/caddy.nix +++ b/modules/core/caddy.nix @@ -16,7 +16,10 @@ let in { services.caddy = { - enable = true; + # Only enable Caddy when at least one domain-based service needs it or + # the operator has defined custom vhosts. This prevents Caddy from + # running on Desktop Only installs that have no web services configured. + enable = needsHttpsPorts || extraVhosts != ""; user = "caddy"; group = "root"; }; diff --git a/modules/core/role-logic.nix b/modules/core/role-logic.nix index fafb030..eab8332 100755 --- a/modules/core/role-logic.nix +++ b/modules/core/role-logic.nix @@ -3,6 +3,13 @@ { config = lib.mkMerge [ + # nix-bitcoin is globally imported by the flake (nixosModules.Sovran_SystemsOS). + # This default satisfies nix-bitcoin's generateSecrets assertion so that Desktop + # Only systems can evaluate without enabling any Bitcoin services. + { + nix-bitcoin.generateSecrets = lib.mkDefault true; + } + # ── Server+Desktop Role (default) ───────────────────────── (lib.mkIf config.sovran_systemsOS.roles.server_plus_desktop { sovran_systemsOS.web.btcpayserver = lib.mkDefault true; @@ -12,15 +19,24 @@ (lib.mkIf config.sovran_systemsOS.roles.desktop { services.desktopManager.gnome.enable = true; + # Force all server/node services and features off so they cannot be + # accidentally enabled via custom.nix or option defaults on Desktop Only. sovran_systemsOS.services = { - synapse = lib.mkDefault false; - bitcoin = lib.mkDefault false; - vaultwarden = lib.mkDefault false; - wordpress = lib.mkDefault false; - nextcloud = lib.mkDefault false; + synapse = lib.mkForce false; + bitcoin = lib.mkForce false; + vaultwarden = lib.mkForce false; + wordpress = lib.mkForce false; + nextcloud = lib.mkForce false; }; - sovran_systemsOS.web.btcpayserver = lib.mkDefault false; + sovran_systemsOS.features = { + haven = lib.mkForce false; + mempool = lib.mkForce false; + element-calling = lib.mkForce false; + bitcoin-core = lib.mkForce false; + }; + + sovran_systemsOS.web.btcpayserver = lib.mkForce false; }) # ── Bitcoin Node Only Role ────────────────────────────────