nixos/caddy: ensure vhosts come after user-specified cfg.extraConfig
This solves an issue, where loading the nixos-unstable module in nixos-stable using `disabledModules` and `imports` resulted in the following Caddyfile: ``` <globalConfig> <vhosts> <extraConfig> ``` instead of ``` <globalConfig> <extraConfig> <vhosts> ``` This is important in cases where `cfg.extraConfig` contains so called Caddyfile snippets. See https://caddyserver.com/docs/caddyfile/concepts#structure Co-authored-by: Lin Jian <me@linj.tech>
This commit is contained in:
parent
f6401f26d0
commit
fcdcccaed6
@ -36,6 +36,7 @@ let
|
||||
${cfg.globalConfig}
|
||||
}
|
||||
${cfg.extraConfig}
|
||||
${concatMapStringsSep "\n" mkVHostConf virtualHosts}
|
||||
'';
|
||||
|
||||
Caddyfile-formatted = pkgs.runCommand "Caddyfile-formatted" { nativeBuildInputs = [ cfg.package ]; } ''
|
||||
@ -340,7 +341,6 @@ in
|
||||
groups = config.users.groups;
|
||||
}) acmeHosts;
|
||||
|
||||
services.caddy.extraConfig = concatMapStringsSep "\n" mkVHostConf virtualHosts;
|
||||
services.caddy.globalConfig = ''
|
||||
${optionalString (cfg.email != null) "email ${cfg.email}"}
|
||||
${optionalString (cfg.acmeCA != null) "acme_ca ${cfg.acmeCA}"}
|
||||
|
Loading…
Reference in New Issue
Block a user