mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 14:10:33 +03:00
Merge pull request #57979 from 4z3/writeNginxConfig
nixos/nginx: use nginxfmt and gixy
This commit is contained in:
commit
6dd7483ce1
3 changed files with 14 additions and 16 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue