Merge pull request #153729 from aanderse/nixos/caddy

nixos/caddy: add globalConfig option

authored by Aaron Andersen and committed by GitHub 2e95239b 0578da5e

+28 -5
+28 -5
nixos/modules/services/web-servers/caddy/default.nix
··· 28 28 let 29 29 Caddyfile = pkgs.writeText "Caddyfile" '' 30 30 { 31 - ${optionalString (cfg.email != null) "email ${cfg.email}"} 32 - ${optionalString (cfg.acmeCA != null) "acme_ca ${cfg.acmeCA}"} 33 - log { 34 - ${cfg.logFormat} 35 - } 31 + ${cfg.globalConfig} 36 32 } 37 33 ${cfg.extraConfig} 38 34 ''; ··· 183 179 ''; 184 180 }; 185 181 182 + globalConfig = mkOption { 183 + type = types.lines; 184 + default = ""; 185 + example = '' 186 + debug 187 + servers { 188 + protocol { 189 + experimental_http3 190 + } 191 + } 192 + ''; 193 + description = '' 194 + Additional lines of configuration appended to the global config section 195 + of the <literal>Caddyfile</literal>. 196 + 197 + Refer to <link xlink:href="https://caddyserver.com/docs/caddyfile/options#global-options"/> 198 + for details on supported values. 199 + ''; 200 + }; 201 + 186 202 extraConfig = mkOption { 187 203 type = types.lines; 188 204 default = ""; ··· 253 269 ]; 254 270 255 271 services.caddy.extraConfig = concatMapStringsSep "\n" mkVHostConf virtualHosts; 272 + services.caddy.globalConfig = '' 273 + ${optionalString (cfg.email != null) "email ${cfg.email}"} 274 + ${optionalString (cfg.acmeCA != null) "acme_ca ${cfg.acmeCA}"} 275 + log { 276 + ${cfg.logFormat} 277 + } 278 + ''; 256 279 257 280 systemd.packages = [ cfg.package ]; 258 281 systemd.services.caddy = {