44 lines
808 B
Nix
44 lines
808 B
Nix
{
|
|
blog,
|
|
nginx,
|
|
system,
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
nginxPort = "80";
|
|
nginxConf = pkgs.writeText "nginx.conf" ''
|
|
user nginx nginx;
|
|
daemon off;
|
|
error_log /dev/stderr;
|
|
pid /httpd.pid;
|
|
events {}
|
|
http {
|
|
access_log /dev/stdout;
|
|
include ${nginx.outPath}/conf/mime.types;
|
|
|
|
server {
|
|
listen ${nginxPort};
|
|
index index.html;
|
|
location / {
|
|
root ${blog.packages.${system}.static-website};
|
|
}
|
|
}
|
|
}
|
|
'';
|
|
in {
|
|
dinit.enable = true;
|
|
|
|
init.services.nginx = {
|
|
shutdownOnExit = true;
|
|
script = lib.mkForce (pkgs.writeShellScript "nginx-run" ''
|
|
HOME=~nginx ${config.services.nginx.package}/bin/nginx -c ${nginxConf}
|
|
'');
|
|
};
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
configuration = [];
|
|
};
|
|
}
|