diff options
author | Izorkin <izorkin@elven.pw> | 2019-04-08 16:44:23 +0300 |
---|---|---|
committer | Izorkin <izorkin@elven.pw> | 2019-04-08 16:44:23 +0300 |
commit | 496a73d46d9eb8c7dc22219e1ae42451fd6860a6 (patch) | |
tree | a36831fccceac40bf4442eb3b611faae072cbf66 /pkgs/build-support/writers | |
parent | d190794b4a489fb3e8d0b4a39e417f2d15fd1963 (diff) |
nixos/nginx: fix error in writeNginxConfig
Diffstat (limited to 'pkgs/build-support/writers')
-rw-r--r-- | pkgs/build-support/writers/default.nix | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix index 3454450c1f3a..281d2b19bc65 100644 --- a/pkgs/build-support/writers/default.nix +++ b/pkgs/build-support/writers/default.nix @@ -178,13 +178,20 @@ 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.runCommand name { inherit text; passAsFile = [ "text" ]; } /* sh */ '' - cp "$textPath" $out - ${pkgs.nginx-config-formatter}/bin/nginxfmt $out - ${pkgs.gnused}/bin/sed -i '/^$/d' $out + # nginx-config-formatter has an error - https://github.com/1connect/nginx-config-formatter/issues/16 + ${pkgs.gawk}/bin/awk -f ${awkFormatNginx} "$textPath" | ${pkgs.gnused}/bin/sed '/^\s*$/d' > $out ${pkgs.gixy}/bin/gixy $out ''; |