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