services.nginx.httpConfig =
let
indexHtml = pkgs.writeTextFile {
name = "index.html";
text = ''
<h2>Hello, world!</h2>
'';
};
webpageRoot = pkgs.stdenv.mkDerivation {
name = "public_html";
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
cp -v ${indexHtml} $out/index.html
'';
};
in
''
server {
location / {
root ${webpageRoot};
}
}
'' ;