summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2020-08-19 20:56:51 -0400
committerGitHub <noreply@github.com>2020-08-19 20:56:51 -0400
commitfd250d57bbd3fdca31ece858d737dc815a3b07fe (patch)
tree8bbe737b170c4712f61980511323d30eae1137bc /nixos
parente7d1b6b59b9d4697d192a270468dad6cb8de9227 (diff)
parent0b91dfedbc4fda3068b58e8514b58f94c7fa972b (diff)
downloadnixpkgs-fd250d57bbd3fdca31ece858d737dc815a3b07fe.tar
nixpkgs-fd250d57bbd3fdca31ece858d737dc815a3b07fe.tar.gz
nixpkgs-fd250d57bbd3fdca31ece858d737dc815a3b07fe.tar.bz2
nixpkgs-fd250d57bbd3fdca31ece858d737dc815a3b07fe.tar.lz
nixpkgs-fd250d57bbd3fdca31ece858d737dc815a3b07fe.tar.xz
nixpkgs-fd250d57bbd3fdca31ece858d737dc815a3b07fe.tar.zst
nixpkgs-fd250d57bbd3fdca31ece858d737dc815a3b07fe.zip
Merge pull request #79123 from aanderse/apachectl
nixos/httpd: remove impurity from /etc
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/default.nix14
1 files changed, 10 insertions, 4 deletions
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index e1d1217943b..46660151f76 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -10,6 +10,12 @@ let
 
   pkg = cfg.package.out;
 
+  apachectl = pkgs.runCommand "apachectl" { meta.priority = -1; } ''
+    mkdir -p $out/bin
+    cp ${pkg}/bin/apachectl $out/bin/apachectl
+    sed -i $out/bin/apachectl -e 's|$HTTPD -t|$HTTPD -t -f ${httpdConf}|'
+  '';
+
   httpdConf = cfg.configFile;
 
   php = cfg.phpPackage.override { apacheHttpd = pkg; };
@@ -650,10 +656,10 @@ in
       postRun = "systemctl reload httpd.service";
     }) (filterAttrs (name: hostOpts: hostOpts.enableACME) cfg.virtualHosts);
 
-    environment.systemPackages = [ pkg ];
-
-    # required for "apachectl configtest"
-    environment.etc."httpd/httpd.conf".source = httpdConf;
+    environment.systemPackages = [
+      apachectl
+      pkg
+    ];
 
     services.httpd.phpOptions =
       ''