Build blog image with NixNG

This commit is contained in:
Pim Kunis 2024-12-31 11:29:29 +01:00
parent bbb149def3
commit 4f956c005c
7 changed files with 156 additions and 58 deletions

View 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 = [];
};
}

View file

@ -2,6 +2,8 @@
self,
flake-utils,
nixng,
nginx,
blog,
nixpkgs,
nixpkgs-jellyseerr,
nixpkgs-bazarr,
@ -18,6 +20,7 @@ flake-utils.lib.eachDefaultSystem (system: let
sonarr = ./sonarr.nix;
bazarr = ./bazarr.nix;
prowlarr = ./prowlarr.nix;
blog = ./blog.nix;
};
in {
nixngConfigurations = builtins.mapAttrs (name: configFile:
@ -27,6 +30,7 @@ in {
config = import configFile;
specialArgs = {
inherit nginx blog;
inherit (self) globals;
};