service/acme: split from nginx

This commit is contained in:
Felix Buehler 2025-01-22 00:48:12 +01:00
parent 0314eeabd6
commit bd2da85ef0
5 changed files with 45 additions and 25 deletions

View file

@ -0,0 +1,36 @@
# automatic certificates
{ config, lib, ... }:
let
cfg = config.my.services.acme;
inherit (config.networking) domain;
in
{
options.my.services.acme = with lib; {
enable = mkEnableOption "ACME certificates";
credentialsFile = mkOption {
type = types.str;
example = "/var/lib/acme/creds.env";
description = ''
INWX API key file as an 'EnvironmentFile' (see `systemd.exec(5)`)
'';
};
};
config = lib.mkIf cfg.enable {
security.acme = {
defaults.email = "server@buehler.rocks";
# this is specially needed for inwx and does not work without it
defaults.dnsResolver = "ns.inwx.de";
acceptTerms = true;
# Use DNS wildcard certificate
certs = {
"${config.networking.domain}" = {
extraDomainNames = [ "*.${config.networking.domain}" ];
dnsProvider = "inwx";
inherit (cfg) credentialsFile;
};
};
};
};
}