2024-03-02 22:05:30 +01:00
|
|
|
{inputs, ...}: {
|
2023-06-13 23:06:10 +02:00
|
|
|
flake.nixngConfigurations.ingressBlowhole = inputs.nixng.nglib.makeSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
name = "ingress-blowhole";
|
2024-07-03 17:39:49 +02:00
|
|
|
nixpkgs = inputs.nixpkgs-stable;
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
config = {
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit
|
|
|
|
(lib)
|
|
|
|
singleton
|
|
|
|
;
|
|
|
|
in {
|
|
|
|
dumb-init = {
|
|
|
|
enable = true;
|
|
|
|
sigell.entries = [
|
|
|
|
{
|
|
|
|
signal = "HUP";
|
|
|
|
action = {
|
|
|
|
type = "exec";
|
|
|
|
environment = {
|
|
|
|
PATH = "${pkgs.bash}/bin:${pkgs.busybox}/bin";
|
|
|
|
};
|
|
|
|
command = [
|
|
|
|
"bash"
|
|
|
|
"-c"
|
|
|
|
"kill -s HUP \"$(cat /nginx.pid)\""
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
signal = "TERM";
|
|
|
|
action = {
|
|
|
|
type = "signal";
|
|
|
|
rewrite = "TERM";
|
|
|
|
selector = {
|
|
|
|
type = "child";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
type.services = {};
|
|
|
|
};
|
|
|
|
init.services.nginx.shutdownOnExit = true;
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
envsubst = true;
|
|
|
|
configuration = singleton {
|
|
|
|
daemon = "off";
|
|
|
|
worker_processes = 2;
|
|
|
|
user = "nginx";
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
events."" = {
|
|
|
|
use = "epoll";
|
|
|
|
worker_connections = 128;
|
|
|
|
};
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
error_log = ["/dev/stderr" "warn"];
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
pid = "/nginx.pid";
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
stream."" = {
|
|
|
|
include = singleton ["/local/streams.conf"];
|
|
|
|
};
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
http."" = {
|
|
|
|
server_tokens = "off";
|
|
|
|
include = [
|
|
|
|
["${pkgs.nginx}/conf/mime.types"]
|
|
|
|
["/local/upstreams.conf"]
|
|
|
|
];
|
|
|
|
charset = "utf-8";
|
|
|
|
access_log = ["/dev/stdout" "combined"];
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
server."" = {
|
|
|
|
listen = ["80" "default_server"];
|
|
|
|
server_name = singleton "blowhole.in.redalder.org";
|
2023-06-13 23:06:10 +02:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
location."/" = {
|
|
|
|
return = ["301" "https://$$host$$request_uri"];
|
2023-06-13 23:06:10 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-03-02 22:05:30 +01:00
|
|
|
};
|
|
|
|
};
|
2023-06-13 23:06:10 +02:00
|
|
|
};
|
|
|
|
}
|