git.iko.soy/typeable/nixpkgs
on master help sign in
nginx: Format the config file
commite362a3d5c94ba379d428fbd2cc40470719a61556 authorSvein Ove Aas <sveina@gmail.com> dateFri 27 Jan 2017, 17:29 (10 years ago) parentb33124a
1 file changed+14−1
nixos/modules/services/web-servers/nginx/default.nix+14−1
nixos/modules/services/web-servers/nginx/default.nix+14−1
@@ -16,7 +16,20 @@ let
1616 ) cfg.virtualHosts;
1717 enableIPv6 = config.networking.enableIPv6;
1818
19− configFile = pkgs.writeText "nginx.conf" ''
19+ configFile = pkgs.runCommand "nginx.conf" {
20+ inherit configFileUnformatted;
21+ passAsFile = [ "configFileUnformatted" ];
22+ # configFileUnformatted is created locally, therefore so should this be.
23+ preferLocalBuild = true;
24+ allowSubstitutes = false;
25+ } ''
26+ cp ${configFileUnformatted} nginx.conf
27+ chmod u+w nginx.conf
28+ ${pkgs.nginx-config-formatter}/bin/nginxfmt nginx.conf
29+ cp nginx.conf $out
30+ '';
31+
32+ configFileUnformatted = pkgs.writeText "nginx.unformatted.conf" ''
2033 user ${cfg.user} ${cfg.group};
2134 error_log stderr;
2235 daemon off;