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.
This commit is contained in:
copilot-swe-agent[bot]
2026-07-03 23:35:30 +00:00
committed by GitHub
parent afe51c4abd
commit e81f6643fc
2 changed files with 26 additions and 7 deletions
+4 -1
View File
@@ -16,7 +16,10 @@ let
in in
{ {
services.caddy = { 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"; user = "caddy";
group = "root"; group = "root";
}; };
+22 -6
View File
@@ -3,6 +3,13 @@
{ {
config = lib.mkMerge [ 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) ───────────────────────── # ── Server+Desktop Role (default) ─────────────────────────
(lib.mkIf config.sovran_systemsOS.roles.server_plus_desktop { (lib.mkIf config.sovran_systemsOS.roles.server_plus_desktop {
sovran_systemsOS.web.btcpayserver = lib.mkDefault true; sovran_systemsOS.web.btcpayserver = lib.mkDefault true;
@@ -12,15 +19,24 @@
(lib.mkIf config.sovran_systemsOS.roles.desktop { (lib.mkIf config.sovran_systemsOS.roles.desktop {
services.desktopManager.gnome.enable = true; 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 = { sovran_systemsOS.services = {
synapse = lib.mkDefault false; synapse = lib.mkForce false;
bitcoin = lib.mkDefault false; bitcoin = lib.mkForce false;
vaultwarden = lib.mkDefault false; vaultwarden = lib.mkForce false;
wordpress = lib.mkDefault false; wordpress = lib.mkForce false;
nextcloud = lib.mkDefault 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 ──────────────────────────────── # ── Bitcoin Node Only Role ────────────────────────────────