2024-03-03 00:06:52 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: {
|
2022-10-12 01:24:54 +01:00
|
|
|
options.services.nginx.domain = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
2021-05-17 00:00:34 +01:00
|
|
|
description = "The base domain name to append to virtual domain names";
|
|
|
|
};
|
2024-03-03 00:06:52 +00:00
|
|
|
|
|
|
|
config = {
|
|
|
|
# Don't attempt to run acme if the domain name is not tlater.net
|
|
|
|
systemd.services = let
|
|
|
|
confirm = ''[[ "tlater.net" = ${config.services.nginx.domain} ]]'';
|
|
|
|
in
|
|
|
|
lib.mapAttrs' (cert: _:
|
|
|
|
lib.nameValuePair "acme-${cert}" {
|
|
|
|
serviceConfig.ExecCondition = ''${pkgs.runtimeShell} -c '${confirm}' '';
|
|
|
|
})
|
|
|
|
config.security.acme.certs;
|
|
|
|
};
|
2021-04-12 01:40:19 +01:00
|
|
|
}
|