diff --git a/nixos/modules/security/acme.xml b/nixos/modules/security/acme.xml
index 15ed4c04a23d..c8a2171eff75 100644
--- a/nixos/modules/security/acme.xml
+++ b/nixos/modules/security/acme.xml
@@ -74,7 +74,27 @@ options for the security.acme module.
+security.acme.certs."foo.example.com" = {
+ webroot = "/var/www/challenges";
+ email = "foo@example.com";
+ user = "nginx";
+ group = "nginx";
+ postRun = "systemctl restart nginx.service";
+};
services.nginx.httpConfig = ''
+ server {
+ server_name foo.example.com;
+ listen [::]:80;
+
+ location /.well-known/acme-challenge {
+ root /var/www/challenges;
+ }
+
+ location / {
+ return 301 https://$host$request_uri;
+ }
+ }
+
server {
server_name foo.example.com;
listen 443 ssl;