hosts: make security settings common

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2025-06-29 18:48:14 +05:30
parent e1e72965f9
commit da4309e2e0
9 changed files with 24 additions and 32 deletions

View File

@@ -0,0 +1,21 @@
{
lib,
conf,
config,
...
}:
let
domain = conf.network.addresses.domain.natto;
nginx = config.services.nginx;
in
{
security = {
acme = lib.mkIf nginx.enable {
acceptTerms = true;
certs = lib.mapAttrs (n: _: { email = "natto@${domain}"; }) (
lib.filterAttrs (_: v: v.enableACME) nginx.virtualHosts
);
};
pki.certificateFiles = [ ../../cert.pem ];
};
}