@@ -5,7 +5,7 @@ with lib;
55let
66 cfg = config.services.nginx;
77 nginx = cfg.package;
8− configFileText = ''
8+ configFile = pkgs.writeText "nginx.conf" ''
99 user ${cfg.user} ${cfg.group};
1010 daemon off;
1111
@@ -19,17 +19,6 @@ let
1919 ''}
2020 ${cfg.appendConfig}
2121 '';
22− configFile = pkgs.runCommand "nginx.conf" {
23− text = configFileText;
24− passAsFile = ["text"];
25− preferLocalBuild = true;
26− allowSubstitutes = false;
27− } ''
28− mkdir -p "$(dirname "$out")"
29− mv "$textPath" "$out"
30− (${nginx}/bin/nginx -t -c "$out" -p ${cfg.stateDir} || true) 2>&1 | grep -q 'syntax is ok'
31− '';
32−
3322in
3423
3524{
@@ -102,6 +91,8 @@ in
10291 };
10392
10493 config = mkIf cfg.enable {
94+ # TODO: test user supplied config file pases syntax test
95+
10596 systemd.services.nginx = {
10697 description = "Nginx Web Server";
10798 after = [ "network.target" ];