nixos/nginx: use writeNginxConfig

This commit is contained in:
tv 2019-03-20 18:49:40 +01:00
parent 7437268cd4
commit 59fac1a6d7
2 changed files with 4 additions and 16 deletions

View File

@ -44,19 +44,7 @@ let
}
''));
awkFormat = 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}
'';
configFile = pkgs.runCommand "nginx.conf" {} (''
awk -f ${awkFormat} ${pre-configFile} | sed '/^\s*$/d' > $out
'');
pre-configFile = pkgs.writeText "pre-nginx.conf" ''
configFile = pkgs.writers.writeNginxConfig "nginx.conf" ''
user ${cfg.user} ${cfg.group};
error_log ${cfg.logError};
daemon off;

View File

@ -1,14 +1,14 @@
{ stdenv, fetchFromGitHub, python3 }:
stdenv.mkDerivation rec {
version = "2016-06-16";
version = "2019-02-13";
name = "nginx-config-formatter-${version}";
src = fetchFromGitHub {
owner = "1connect";
repo = "nginx-config-formatter";
rev = "fe5c77d2a503644bebee2caaa8b222c201c0603d";
sha256 = "0akpkbq5136k1i1z1ls6yksis35hbr70k8vd10laqwvr1jj41bga";
rev = "4ea6bbc1bdeb1d28419548aeca90f323e64e0e05";
sha256 = "0h6pj9i0wim9pzkafi92l1nhlnl2a530vnm7qqi3n2ra8iwfyw4f";
};
buildInputs = [ python3 ];