aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/websites')
-rw-r--r--modules/private/websites/default.nix18
-rw-r--r--modules/private/websites/tools/mail/mta-sts.nix42
2 files changed, 33 insertions, 27 deletions
diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix
index e2bcef5..119d62e 100644
--- a/modules/private/websites/default.nix
+++ b/modules/private/websites/default.nix
@@ -64,15 +64,19 @@ let
64 makeExtraConfig = (builtins.filter (x: x != null) (lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) apacheConfig)); 64 makeExtraConfig = (builtins.filter (x: x != null) (lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) apacheConfig));
65in 65in
66{ 66{
67 options.myServices.websites.webappDirs = lib.mkOption { 67 options.myServices.websites = {
68 type = lib.types.attrsOf lib.types.path; 68 enable = lib.mkEnableOption "enable websites";
69 description = '' 69
70 Webapp paths to create in /run/current-system/webapps 70 webappDirs = lib.mkOption {
71 ''; 71 type = lib.types.attrsOf lib.types.path;
72 default = {}; 72 description = ''
73 Webapp paths to create in /run/current-system/webapps
74 '';
75 default = {};
76 };
73 }; 77 };
74 78
75 config = { 79 config = lib.mkIf config.myServices.websites.enable {
76 services.backup.profiles.php = { 80 services.backup.profiles.php = {
77 rootDir = "/var/lib/php"; 81 rootDir = "/var/lib/php";
78 }; 82 };
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
28 "cp ${file d} $out/${d.domain}.txt" 28 "cp ${file d} $out/${d.domain}.txt"
29 ) domains)} 29 ) domains)}
30 ''; 30 '';
31 cfg = config.myServices.websites.tools.email;
31in 32in
32{ 33{
33 config.myServices.websites.webappDirs = { 34 config = lib.mkIf cfg.enable {
34 _mta-sts = root; 35 myServices.websites.webappDirs = {
35 }; 36 _mta-sts = root;
37 };
36 38
37 config.services.websites.env.tools.vhostConfs.mta_sts = { 39 services.websites.env.tools.vhostConfs.mta_sts = {
38 certName = "mail"; 40 certName = "mail";
39 addToCerts = true; 41 addToCerts = true;
40 hosts = ["mta-sts.mail.immae.eu"] ++ map (v: "mta-sts.${v.domain}") domains; 42 hosts = ["mta-sts.mail.immae.eu"] ++ map (v: "mta-sts.${v.domain}") domains;
41 root = "/run/current-system/webapps/_mta-sts"; 43 root = "/run/current-system/webapps/_mta-sts";
42 extraConfig = [ 44 extraConfig = [
43 '' 45 ''
44 RewriteEngine on 46 RewriteEngine on
45 RewriteCond %{HTTP_HOST} ^mta-sts.(.*)$ 47 RewriteCond %{HTTP_HOST} ^mta-sts.(.*)$
46 RewriteRule ^/.well-known/mta-sts.txt$ %{DOCUMENT_ROOT}/%1.txt [L] 48 RewriteRule ^/.well-known/mta-sts.txt$ %{DOCUMENT_ROOT}/%1.txt [L]
47 <Directory /run/current-system/webapps/_mta-sts> 49 <Directory /run/current-system/webapps/_mta-sts>
48 Require all granted 50 Require all granted
49 Options -Indexes 51 Options -Indexes
50 </Directory> 52 </Directory>
51 '' 53 ''
52 ]; 54 ];
55 };
53 }; 56 };
54
55} 57}