clanModules.nginx: replace acme fact with concrete value

We shouldn't abuse prompts to require a user to set an option. Instead
our NixOS modules should expose which option need to be specified by the
user.
This commit is contained in:
Jörg Thalheim
2024-09-11 11:23:11 +02:00
parent 3c1dc81c4b
commit 64342c9153
2 changed files with 11 additions and 12 deletions

View File

@@ -22,7 +22,7 @@
enableACME = lib.mkForce false; enableACME = lib.mkForce false;
forceSSL = lib.mkForce false; forceSSL = lib.mkForce false;
}; };
security.acme.defaults.email = "admin@clan.test"; clan.nginx.acme.email = "admins@clan.lol";
clan.matrix-synapse = { clan.matrix-synapse = {
server_tld = "clan.test"; server_tld = "clan.test";
app_domain = "matrix.clan.test"; app_domain = "matrix.clan.test";

View File

@@ -10,20 +10,19 @@
] "Importing the module will already enable the service.") ] "Importing the module will already enable the service.")
]; ];
config = { options = {
clan.nginx.acme.email = lib.mkOption {
clan.core.facts.services."nginx-acme-email" = { type = lib.types.str;
public."nginx-acme-email" = { }; description = ''
generator.prompt = "Please enter your email address for Let's Encrypt certificate generation"; Email address for account creation and correspondence from the CA.
It is recommended to use the same email for all certs to avoid account
generator.script = '' creation limits.
echo -n "$prompt_value" | tr -d "\n" > "$facts"/nginx-acme-email
''; '';
}; };
};
config = {
security.acme.acceptTerms = true; security.acme.acceptTerms = true;
security.acme.defaults.email = security.acme.defaults.email = config.clan.nginx.acme.email;
lib.mkDefault
config.clan.core.facts.services."nginx-acme-email".public."nginx-acme-email".value;
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
443 443