nixos/httpd: override apachectl command to use generated httpd configuration

This commit is contained in:
Aaron Andersen 2020-02-02 08:38:57 -05:00
parent e23ba2a1b0
commit 0b91dfedbc

View file

@ -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 =
''