From e23ba2a1b0ec3d06c347c241042bd1e9f1fee074 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Sun, 2 Feb 2020 08:08:02 -0500 Subject: [PATCH 1/2] Revert "nixos/httpd: symlink apache configuration to /etc/httpd/httpd.conf for use in the apachectl command" This reverts commit 336a6f471f1e40d4a440b4176c2a1b8db65fe007. --- nixos/modules/services/web-servers/apache-httpd/default.nix | 3 --- pkgs/servers/http/apache-httpd/2.4.nix | 1 - 2 files changed, 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 3200a26364f68c..6a497c40def592 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -643,9 +643,6 @@ in environment.systemPackages = [ pkg ]; - # required for "apachectl configtest" - environment.etc."httpd/httpd.conf".source = httpdConf; - services.httpd.phpOptions = '' ; Needed for PHP's mail() function. diff --git a/pkgs/servers/http/apache-httpd/2.4.nix b/pkgs/servers/http/apache-httpd/2.4.nix index 252365098ddc14..d5da6df8d689b8 100644 --- a/pkgs/servers/http/apache-httpd/2.4.nix +++ b/pkgs/servers/http/apache-httpd/2.4.nix @@ -39,7 +39,6 @@ stdenv.mkDerivation rec { prePatch = '' sed -i config.layout -e "s|installbuilddir:.*|installbuilddir: $dev/share/build|" sed -i support/apachectl.in -e 's|@LYNX_PATH@|${lynx}/bin/lynx|' - sed -i support/apachectl.in -e 's|$HTTPD -t|$HTTPD -t -f /etc/httpd/httpd.conf|' ''; # Required for ‘pthread_cancel’. From 0b91dfedbc4fda3068b58e8514b58f94c7fa972b Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Sun, 2 Feb 2020 08:38:57 -0500 Subject: [PATCH 2/2] nixos/httpd: override apachectl command to use generated httpd configuration --- .../services/web-servers/apache-httpd/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 6a497c40def592..5ff3c5d313be67 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.dev; /* otherwise it only gets .out */ }; @@ -641,7 +647,10 @@ in postRun = "systemctl reload httpd.service"; }) (filterAttrs (name: hostOpts: hostOpts.enableACME) cfg.virtualHosts); - environment.systemPackages = [ pkg ]; + environment.systemPackages = [ + apachectl + pkg + ]; services.httpd.phpOptions = ''