X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=blobdiff_plain;f=modules%2Fprivate%2Fwebsites%2Ftools%2Fmail%2Fmta-sts.nix;h=d443f55115710f8573ff326795605e0fedded54e;hp=bedefdaf8643b0c63b14ec445f8704f21cc442c3;hb=8415083eb6acc343dfa404dbbc12fa0171a48a20;hpb=8fa7ff2c63fb0722144bc90837512d9f8b8c929d diff --git a/modules/private/websites/tools/mail/mta-sts.nix b/modules/private/websites/tools/mail/mta-sts.nix index bedefda..d443f55 100644 --- a/modules/private/websites/tools/mail/mta-sts.nix +++ b/modules/private/websites/tools/mail/mta-sts.nix @@ -28,28 +28,30 @@ let "cp ${file d} $out/${d.domain}.txt" ) domains)} ''; + cfg = config.myServices.websites.tools.email; in { - config.myServices.websites.webappDirs = { - _mta-sts = root; - }; + config = lib.mkIf cfg.enable { + myServices.websites.webappDirs = { + _mta-sts = root; + }; - config.services.websites.env.tools.vhostConfs.mta_sts = { - certName = "mail"; - addToCerts = true; - hosts = ["mta-sts.mail.immae.eu"] ++ map (v: "mta-sts.${v.domain}") domains; - root = "/run/current-system/webapps/_mta-sts"; - extraConfig = [ - '' - RewriteEngine on - RewriteCond %{HTTP_HOST} ^mta-sts.(.*)$ - RewriteRule ^/.well-known/mta-sts.txt$ %{DOCUMENT_ROOT}/%1.txt [L] - - Require all granted - Options -Indexes - - '' - ]; + services.websites.env.tools.vhostConfs.mta_sts = { + certName = "mail"; + addToCerts = true; + hosts = ["mta-sts.mail.immae.eu"] ++ map (v: "mta-sts.${v.domain}") domains; + root = "/run/current-system/webapps/_mta-sts"; + extraConfig = [ + '' + RewriteEngine on + RewriteCond %{HTTP_HOST} ^mta-sts.(.*)$ + RewriteRule ^/.well-known/mta-sts.txt$ %{DOCUMENT_ROOT}/%1.txt [L] + + Require all granted + Options -Indexes + + '' + ]; + }; }; - }