depot/cluster/services/websites/host.nix

24 lines
596 B
Nix
Raw Normal View History

2022-10-17 15:54:48 +03:00
{ inputs, lib, pkgs, tools, ... }:
2022-08-09 21:10:25 +03:00
let
importWebsites = expr: import expr {
tools = tools.nginx;
packages = inputs.self.packages.${pkgs.system};
};
websites = tools.nginx.mappers.mapSubdomains (importWebsites ./websites.nix);
acmeUseDNS = name: conf: {
name = conf.useACMEHost or conf.serverName or name;
value = {
dnsProvider = "pdns";
webroot = null;
};
};
isACME = _: conf: conf ? enableACME && conf.enableACME;
in {
services.nginx.virtualHosts = websites;
security.acme.certs = lib.mapAttrs' acmeUseDNS (lib.filterAttrs isACME websites);
}