nixos/nginx: use writeNginxConfig
This commit is contained in:
parent
7437268cd4
commit
59fac1a6d7
@ -44,19 +44,7 @@ let
|
|||||||
}
|
}
|
||||||
''));
|
''));
|
||||||
|
|
||||||
awkFormat = builtins.toFile "awkFormat-nginx.awk" ''
|
configFile = pkgs.writers.writeNginxConfig "nginx.conf" ''
|
||||||
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" ''
|
|
||||||
user ${cfg.user} ${cfg.group};
|
user ${cfg.user} ${cfg.group};
|
||||||
error_log ${cfg.logError};
|
error_log ${cfg.logError};
|
||||||
daemon off;
|
daemon off;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
{ stdenv, fetchFromGitHub, python3 }:
|
{ stdenv, fetchFromGitHub, python3 }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "2016-06-16";
|
version = "2019-02-13";
|
||||||
name = "nginx-config-formatter-${version}";
|
name = "nginx-config-formatter-${version}";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "1connect";
|
owner = "1connect";
|
||||||
repo = "nginx-config-formatter";
|
repo = "nginx-config-formatter";
|
||||||
rev = "fe5c77d2a503644bebee2caaa8b222c201c0603d";
|
rev = "4ea6bbc1bdeb1d28419548aeca90f323e64e0e05";
|
||||||
sha256 = "0akpkbq5136k1i1z1ls6yksis35hbr70k8vd10laqwvr1jj41bga";
|
sha256 = "0h6pj9i0wim9pzkafi92l1nhlnl2a530vnm7qqi3n2ra8iwfyw4f";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ python3 ];
|
buildInputs = [ python3 ];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user