diff options
author | Svein Ove Aas <sveina@gmail.com> | 2017-01-27 17:29:46 +0000 |
---|---|---|
committer | Robin Gloster <mail@glob.in> | 2017-02-07 16:19:11 +0100 |
commit | e362a3d5c94ba379d428fbd2cc40470719a61556 (patch) | |
tree | 0047ca97eae27e38d5b55cef04aa91332b803b09 /nixos/modules/services/web-servers/nginx | |
parent | b33124a143a9e4942c5d641e6fee8761c37b676c (diff) | |
download | nixlib-e362a3d5c94ba379d428fbd2cc40470719a61556.tar nixlib-e362a3d5c94ba379d428fbd2cc40470719a61556.tar.gz nixlib-e362a3d5c94ba379d428fbd2cc40470719a61556.tar.bz2 nixlib-e362a3d5c94ba379d428fbd2cc40470719a61556.tar.lz nixlib-e362a3d5c94ba379d428fbd2cc40470719a61556.tar.xz nixlib-e362a3d5c94ba379d428fbd2cc40470719a61556.tar.zst nixlib-e362a3d5c94ba379d428fbd2cc40470719a61556.zip |
nginx: Format the config file
Diffstat (limited to 'nixos/modules/services/web-servers/nginx')
-rw-r--r-- | nixos/modules/services/web-servers/nginx/default.nix | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix index c9eacdd85dcd..815769b243f9 100644 --- a/nixos/modules/services/web-servers/nginx/default.nix +++ b/nixos/modules/services/web-servers/nginx/default.nix @@ -16,7 +16,20 @@ let ) cfg.virtualHosts; enableIPv6 = config.networking.enableIPv6; - configFile = pkgs.writeText "nginx.conf" '' + configFile = pkgs.runCommand "nginx.conf" { + inherit configFileUnformatted; + passAsFile = [ "configFileUnformatted" ]; + # configFileUnformatted is created locally, therefore so should this be. + preferLocalBuild = true; + allowSubstitutes = false; + } '' + cp ${configFileUnformatted} nginx.conf + chmod u+w nginx.conf + ${pkgs.nginx-config-formatter}/bin/nginxfmt nginx.conf + cp nginx.conf $out + ''; + + configFileUnformatted = pkgs.writeText "nginx.unformatted.conf" '' user ${cfg.user} ${cfg.group}; error_log stderr; daemon off; |