Revert "nixos/nginx: return nginx config formatter" (#525375)

Breaks because 

```
nixfmt: error: unrecognized arguments: --max-empty-lines
```
This commit is contained in:
Martin Weinelt
2026-05-29 00:27:23 +02:00
committed by GitHub
+10 -3
View File
@@ -1095,6 +1095,14 @@ rec {
*/
writeJSBin = name: writeJS "/bin/${name}";
awkFormatNginx = builtins.toFile "awkFormat-nginx.awk" ''
awk -f
{sub(/^[ \t]+/,"");idx=0}
/\{/{ctx++;idx=1}
/\}/{ctx--}
{id="";for(i=idx;i<ctx;i++)id=sprintf("%s%s", id, "\t");printf "%s%s\n", id, $0}
'';
writeNginxConfig =
name: text:
pkgs.runCommandLocal name
@@ -1104,9 +1112,8 @@ rec {
nativeBuildInputs = [ gixy ];
} # sh
''
cp "$textPath" $out
${lib.getExe pkgs.nginx-config-formatter} --max-empty-lines 0 $out
${lib.getExe pkgs.gnused} -i 's/ ;/;/g' $out
# nginx-config-formatter has an error - https://github.com/1connect/nginx-config-formatter/issues/16
awk -f ${awkFormatNginx} "$textPath" | sed '/^\s*$/d' > $out
gixy $out || (echo "\n\nThis can be caused by combining multiple incompatible services on the same hostname.\n\nFull merged config:\n\n"; cat $out; exit 1)
'';