This commit is contained in:
Henri Dohmen 2025-06-05 22:55:17 +02:00
parent c26cc20f57
commit d53e340966
8 changed files with 93 additions and 36 deletions

View file

@ -1,4 +1,4 @@
{ ... }:
{
imports = [ ];
imports = [ ./nginx.nix ];
}

44
mod/nginx.nix Normal file
View file

@ -0,0 +1,44 @@
{
lib,
options,
config,
...
}:
with lib;
{
options.services.nginx.virtualHostsPub = mkOption {
type = options.services.nginx.virtualHosts.type;
default = { };
description = "Declarative vhost config listening to ::0 and 0.0.0.0";
};
config = {
services.nginx.virtualHosts = builtins.mapAttrs (
_: v:
v
// {
addSSL = true;
listen = [
{
addr = "0.0.0.0";
port = 443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
}
{
addr = "[::0]";
port = 443;
ssl = true;
}
{
addr = "[::0]";
port = 80;
}
];
}
) config.services.nginx.virtualHostsPub;
};
}