Tutorial for setting up the LAMP stack on a NixOS server?

Would a derivation like this work for the source code?

with import <nixpkgs> {};

stdenv.mkDerivation {
  name = "source-code-php";

  src = /home/stian/path/to/source/code;

  phases = [ "installPhase" ];
  installPhase = ''
    cp -r $src $out
  '';
}

When I build that with nix-build source-derivation.nix that seems to work, and I get a result pointing to a path in the store. How can I use this derivation within my configuration.nix? Do I import it like this?

{ config, pkgs, ... }: {
  imports = [
    ./hardware-configuration.nix
    ./source-derivation.nix
  ];
...

If so, how do I specify that the apache documentroot should point to the result of that derivation?

Thanks again for the help so far!