···365365 # Only try loading the credentialsFile if the dns challenge is enabled
366366 EnvironmentFile = mkIf useDns data.credentialsFile;
367367368368+ Environment = mkIf useDns
369369+ (mapAttrsToList (k: v: ''"${k}=%d/${k}"'') data.credentialFiles);
370370+371371+ LoadCredential = mkIf useDns
372372+ (mapAttrsToList (k: v: "${k}:${v}") data.credentialFiles);
373373+368374 # Run as root (Prefixed with +)
369375 ExecStartPost = "+" + (pkgs.writeShellScript "acme-postrun" ''
370376 cd /var/lib/acme/${escapeShellArg cert}
···617623 <https://go-acme.github.io/lego/dns/> for the corresponding dnsProvider.
618624 '';
619625 example = "/var/src/secrets/example.org-route53-api-token";
626626+ };
627627+628628+ credentialFiles = mkOption {
629629+ type = types.attrsOf (types.path);
630630+ inherit (defaultAndText "credentialFiles" {}) default defaultText;
631631+ description = lib.mdDoc ''
632632+ Environment variables suffixed by "_FILE" to set for the cert's service
633633+ for your selected dnsProvider.
634634+ To find out what values you need to set, consult the documentation at
635635+ <https://go-acme.github.io/lego/dns/> for the corresponding dnsProvider.
636636+ This allows to securely pass credential files to lego by leveraging systemd
637637+ credentials.
638638+ '';
639639+ example = literalExpression ''
640640+ {
641641+ "RFC2136_TSIG_SECRET_FILE" = "/run/secrets/tsig-secret-example.org";
642642+ }
643643+ '';
620644 };
621645622646 dnsPropagationCheck = mkOption {
···927951 One of `security.acme.certs.${cert}.dnsProvider`,
928952 `security.acme.certs.${cert}.webroot`, or
929953 `security.acme.certs.${cert}.listenHTTP` must be provided.
954954+ '';
955955+ }
956956+ {
957957+ assertion = all (hasSuffix "_FILE") (attrNames data.credentialFiles);
958958+ message = ''
959959+ Option `security.acme.certs.${cert}.credentialFiles` can only be
960960+ used for variables suffixed by "_FILE".
930961 '';
931962 }
932963 ]) cfg.certs));