From 16570980b66fac49e0552ef84cc2ee96ff5f9616 Mon Sep 17 00:00:00 2001 From: alyaeanyx Date: Sat, 28 Dec 2024 09:47:58 +0100 Subject: [PATCH] nixos/wstunnel: improve assertions nixos/wstunnel: run nixfmt on module file --- nixos/modules/services/networking/wstunnel.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/networking/wstunnel.nix b/nixos/modules/services/networking/wstunnel.nix index bf56858a190fc..64e4da527f90b 100644 --- a/nixos/modules/services/networking/wstunnel.nix +++ b/nixos/modules/services/networking/wstunnel.nix @@ -168,7 +168,7 @@ let }; localToRemote = lib.mkOption { - description = ''Listen on local and forwards traffic from remote.''; + description = "Listen on local and forwards traffic from remote."; type = lib.types.listOf (lib.types.str); default = [ ]; example = [ @@ -468,10 +468,11 @@ in (lib.mapAttrsToList (name: serverCfg: { assertion = - (serverCfg.tlsCertificate == null && serverCfg.tlsKey == null) - || (serverCfg.tlsCertificate != null && serverCfg.tlsKey != null); + serverCfg.enableHTTPS + -> + (serverCfg.useACMEHost != null) || (serverCfg.tlsCertificate != null && serverCfg.tlsKey != null); message = '' - services.wstunnel.servers."${name}".tlsCertificate and services.wstunnel.servers."${name}".tlsKey need to be set together. + If services.wstunnel.servers."${name}".enableHTTPS is set to true, either services.wstunnel.servers."${name}".useACMEHost or both services.wstunnel.servers."${name}".tlsKey and services.wstunnel.servers."${name}".tlsCertificate need to be set. ''; }) cfg.servers) ++