mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
nixos/caddy: validate at build-time
This commit is contained in:
parent
1ef1bcec09
commit
63b6df42de
1 changed files with 17 additions and 1 deletions
|
@ -45,7 +45,23 @@ let
|
|||
settingsFormat.generate "caddy.json" cfg.settings
|
||||
else
|
||||
let
|
||||
Caddyfile = pkgs.writeTextDir "Caddyfile" ''
|
||||
writeCaddyfile =
|
||||
text:
|
||||
pkgs.runCommandLocal "Caddyfile"
|
||||
{
|
||||
inherit text;
|
||||
passAsFile = [ "text" ];
|
||||
}
|
||||
''
|
||||
mkdir -p $out
|
||||
cp "$textPath" $out/Caddyfile
|
||||
|
||||
# 'validate' cannot be used for validation, due to log location access
|
||||
# See https://github.com/caddyserver/caddy/issues/6788
|
||||
${lib.getExe cfg.package} adapt --config $out/Caddyfile
|
||||
'';
|
||||
|
||||
Caddyfile = writeCaddyfile ''
|
||||
{
|
||||
${cfg.globalConfig}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue