1 { pkgs, lib, config, hosts, ... }:
3 domain = "sourcephile.fr";
4 domainID = lib.replaceStrings ["."] ["_"] domain;
5 inherit (config.security) gnupg;
6 inherit (config.users) users groups;
9 networking.nftables.ruleset = ''
11 # ACME DNS-01 challenge and Gandi DNS
12 set output-net-lego-ipv4 {
15 ${hosts.mermet._module.args.ipv4},
19 set output-net-lego-ipv6 {
21 elements = { 2001:4b98:d:1::40 }
25 security.acme.certs."${domain}" = {
26 email = "root+letsencrypt@${domain}";
30 group = groups.acme.name;
32 dnsProvider = "rfc2136";
33 # ns6.gandi.net takes roughly 5min to update
34 # hence lego's RFC2136_PROPAGATION_TIMEOUT=1000
35 #dnsPropagationCheck = false;
36 credentialsFile = gnupg.secrets."lego/${domain}/rfc2136".path;
38 security.gnupg.secrets."lego/${domain}/rfc2136" = {
40 cat - ${pkgs.writeText "env" ''
41 RFC2136_NAMESERVER=ns.${domain}:53
42 RFC2136_TSIG_ALGORITHM=hmac-sha256.
43 RFC2136_TSIG_KEY=acme_${domainID}
44 RFC2136_PROPAGATION_TIMEOUT=1000
45 RFC2136_POLLING_INTERVAL=30
46 RFC2136_SEQUENCE_INTERVAL=30
47 RFC2136_DNS_TIMEOUT=1000
52 systemd.services."acme-${domain}" = {
55 gnupg.secrets."lego/${domain}/rfc2136".service
59 gnupg.secrets."lego/${domain}/rfc2136".service