]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/immae/production.nix
Add matrix configuration
[perso/Immae/Config/Nix.git] / modules / private / websites / immae / production.nix
CommitLineData
ab8f306d 1{ lib, pkgs, config, ... }:
f759f52e 2let
f8026b6e 3 cfg = config.myServices.websites.immae.production;
cb589b2e
IB
4 varDir = "/var/lib/buildbot/outputs/immae/blog";
5 coursDir = "/var/lib/buildbot/outputs/immae/cours";
6 rechercheDir = "/var/lib/buildbot/outputs/immae/recherche";
7 recettesDir = "/var/lib/buildbot/outputs/immae/recettes";
577d00ee 8 historyDir = "/var/lib/buildbot/outputs/immae/history";
ab8f306d 9 env = config.myEnv.websites.immae;
f759f52e 10in {
f8026b6e 11 options.myServices.websites.immae.production.enable = lib.mkEnableOption "enable Immae's website";
f759f52e 12
f8026b6e 13 config = lib.mkIf cfg.enable {
9eae2b47 14 services.webstats.sites = [ { name = "www.immae.eu"; } ];
f759f52e 15
d3452fc5
IB
16 services.websites.env.production.vhostConfs.immae_production = {
17 certName = "immae";
18 addToCerts = true;
19 certMainHost = "www.immae.eu";
20 hosts = [ "www.immae.eu" "immae.eu" ];
21 root = varDir;
22 extraConfig = [
f759f52e
IB
23 ''
24 Use Stats www.immae.eu
46c99b57 25 Header always set Strict-Transport-Security "max-age=31536000"
f759f52e 26
6da0830e
IB
27 <LocationMatch /.well-known/(webfinger|host-meta)>
28 Header always set Referrer-Policy "strict-origin-when-cross-origin"
6da0830e
IB
29 RequestHeader set X-Forwarded-Proto "https"
30
31 RewriteRule ^(.*)$ https://mastodon.immae.eu%{REQUEST_URI} [QSA,L]
32 </LocationMatch>
33
34 RewriteEngine On
35 RewriteCond "%{REQUEST_URI}" "!^/.well-known/(webfinger|host-meta)"
36 RewriteCond "%{HTTP_HOST}" "!^www\.immae\.eu$" [NC]
37 RewriteRule ^(.+)$ https://www.immae.eu$1 [R=302,L]
38
f759f52e 39 <Directory ${varDir}>
0012da0f
IB
40 DirectoryIndex index.htm index.html
41 Options Indexes FollowSymLinks MultiViews Includes
42 AllowOverride All
43 Require all granted
44 </Directory>
45
196c6e3c
IB
46 Alias /.well-known/chatonsinfos ${./chatons}
47 <Directory ${./chatons}>
48 Options Indexes FollowSymLinks MultiViews Includes
49 AllowOverride None
50 Require all granted
51 </Directory>
57a42113
IB
52
53 Alias /.well-known/matrix ${./matrix}
54 <Directory ${./matrix}>
55 Options Indexes FollowSymLinks MultiViews Includes
56 AllowOverride None
57 Require all granted
58 Header always set Access-Control-Allow-Origin "*"
59 </Directory>
196c6e3c 60
0012da0f
IB
61 Alias /cours ${coursDir}
62 <Directory ${coursDir}>
63 DirectoryIndex index.htm index.html
64 Options Indexes FollowSymLinks MultiViews Includes
65 AllowOverride All
66 Require all granted
67 </Directory>
68
23f9fdf0
IB
69 Alias /eurl ${./eurl}
70 <Directory ${./eurl}>
71 DirectoryIndex index.htm index.html
72 Options Indexes FollowSymLinks MultiViews Includes
73 AllowOverride None
74 Require all granted
75 </Directory>
76
0012da0f
IB
77 Alias /recherche ${rechercheDir}
78 <Directory ${rechercheDir}>
79 DirectoryIndex index.htm index.html
f759f52e
IB
80 Options Indexes FollowSymLinks MultiViews Includes
81 AllowOverride All
82 Require all granted
83 </Directory>
f2a18fd6
IB
84
85 Alias /recettes ${recettesDir}
86 <Directory ${recettesDir}>
87 DirectoryIndex index.htm index.html
88 Options Indexes FollowSymLinks MultiViews Includes
89 AllowOverride All
90 Require all granted
91 </Directory>
7130402c
IB
92
93 Alias /history ${historyDir}
94 <Directory ${historyDir}>
95 DirectoryIndex index.html
96 AllowOverride None
97 Require all granted
98 </Directory>
f759f52e
IB
99 ''
100 ];
101 };
70606070 102
d3452fc5
IB
103 services.websites.env.production.vhostConfs.immae_fr = {
104 certName = "immae";
8cf37c75
IB
105 addToCerts = true;
106 hosts = [ "www.immae.fr" "immae.fr" ];
107 root = null;
108 extraConfig = [ ''
109 RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://www.immae.eu/chapeaux/
110 '' ];
111 };
112
d3452fc5
IB
113 services.websites.env.production.vhostConfs.immae_bouya = {
114 certName = "immae";
7df420c2 115 addToCerts = true;
70606070 116 hosts = [ "bouya.org" "www.bouya.org" ];
c5f1602f 117 root = rechercheDir;
70606070 118 extraConfig = [ ''
c5f1602f
IB
119 <Directory ${rechercheDir}>
120 DirectoryIndex index.htm index.html
121 Options Indexes FollowSymLinks MultiViews Includes
122 AllowOverride All
123 Require all granted
124 </Directory>
70606070
IB
125 '' ];
126 };
f759f52e
IB
127 };
128}