Skip to content

Commit

Permalink
Merge pull request #79123 from aanderse/apachectl
Browse files Browse the repository at this point in the history
nixos/httpd: remove impurity from /etc
  • Loading branch information
aanderse committed Aug 20, 2020
2 parents e7d1b6b + 0b91dfe commit fd250d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 10 additions & 4 deletions nixos/modules/services/web-servers/apache-httpd/default.nix
Expand Up @@ -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; };
Expand Down Expand Up @@ -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 =
''
Expand Down
1 change: 0 additions & 1 deletion pkgs/servers/http/apache-httpd/2.4.nix
Expand Up @@ -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’.
Expand Down

0 comments on commit fd250d5

Please sign in to comment.