I’ve freshly migrated from Arch and am running NixOS unstable with plasma. I set up an apache server as follows (i don’t need mysql, just php and don’t want the server to be reachable from outside):
I just wrote that config from memory, on a mobile device, after not touching apache for a few months… so if it doesn’t work ping me back and I’ll take a look.
Also (i’m new to NixOS, sorry): do i need to put this into environment.systemPackages as well to have Emacs interface with php correctly or is it sufficient to define it with Apache only?
Also also, is the correct way to install php81Packages.composer as an individual entry under environment.systemPackages or do i need to include it with Apache and the pkgs.php.buildEnv somehow?
Why would you expect there to be anything in /srv? Setting document root just makes Apache look in that directory but it is up to you to create and populate it.
services.httpd.phpPackage is only relevant to Apache, if you want to have PHP & composer available on PATH, you will need to install each of them separately, e.g. through environment.systemPackages.
You will want to do something like the following to have Composer run in the same PHP environment:
let
php = pkgs.php.buildEnv {
…
};
in
{
environment.systemPackages = [
php
php.packages.composer
];
}
Though, instead of installing development tools system-wide, it is generally preferred to scope them to each project with nix-shell or something like direnv. Editors like emacs usually have integration for that.