nginx: Format the config file
This commit is contained in:
parent
b33124a143
commit
e362a3d5c9
@ -16,7 +16,20 @@ let
|
|||||||
) cfg.virtualHosts;
|
) cfg.virtualHosts;
|
||||||
enableIPv6 = config.networking.enableIPv6;
|
enableIPv6 = config.networking.enableIPv6;
|
||||||
|
|
||||||
configFile = pkgs.writeText "nginx.conf" ''
|
configFile = pkgs.runCommand "nginx.conf" {
|
||||||
|
inherit configFileUnformatted;
|
||||||
|
passAsFile = [ "configFileUnformatted" ];
|
||||||
|
# configFileUnformatted is created locally, therefore so should this be.
|
||||||
|
preferLocalBuild = true;
|
||||||
|
allowSubstitutes = false;
|
||||||
|
} ''
|
||||||
|
cp ${configFileUnformatted} nginx.conf
|
||||||
|
chmod u+w nginx.conf
|
||||||
|
${pkgs.nginx-config-formatter}/bin/nginxfmt nginx.conf
|
||||||
|
cp nginx.conf $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
configFileUnformatted = pkgs.writeText "nginx.unformatted.conf" ''
|
||||||
user ${cfg.user} ${cfg.group};
|
user ${cfg.user} ${cfg.group};
|
||||||
error_log stderr;
|
error_log stderr;
|
||||||
daemon off;
|
daemon off;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user