Build blog image with NixNG
This commit is contained in:
parent
bbb149def3
commit
4f956c005c
7 changed files with 156 additions and 58 deletions
44
nixng-configurations/blog.nix
Normal file
44
nixng-configurations/blog.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
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 = [];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue