]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/immae/production.nix
Fix overlay import
[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;
8fa7ff2c 4 varDir = "/var/lib/buildbot/outputs/immaeEu";
0012da0f
IB
5 coursDir = "/var/lib/buildbot/outputs/cours";
6 rechercheDir = "/var/lib/buildbot/outputs/recherche";
f2a18fd6 7 recettesDir = "/var/lib/buildbot/outputs/recettes";
ab8f306d 8 env = config.myEnv.websites.immae;
f759f52e 9in {
f8026b6e 10 options.myServices.websites.immae.production.enable = lib.mkEnableOption "enable Immae's website";
f759f52e 11
f8026b6e 12 config = lib.mkIf cfg.enable {
9eae2b47 13 services.webstats.sites = [ { name = "www.immae.eu"; } ];
f759f52e 14
d3452fc5
IB
15 services.websites.env.production.vhostConfs.immae_production = {
16 certName = "immae";
17 addToCerts = true;
18 certMainHost = "www.immae.eu";
19 hosts = [ "www.immae.eu" "immae.eu" ];
20 root = varDir;
21 extraConfig = [
f759f52e
IB
22 ''
23 Use Stats www.immae.eu
24
6da0830e
IB
25 <LocationMatch /.well-known/(webfinger|host-meta)>
26 Header always set Referrer-Policy "strict-origin-when-cross-origin"
27 Header always set Strict-Transport-Security "max-age=31536000"
28 RequestHeader set X-Forwarded-Proto "https"
29
30 RewriteRule ^(.*)$ https://mastodon.immae.eu%{REQUEST_URI} [QSA,L]
31 </LocationMatch>
32
33 RewriteEngine On
34 RewriteCond "%{REQUEST_URI}" "!^/.well-known/(webfinger|host-meta)"
35 RewriteCond "%{HTTP_HOST}" "!^www\.immae\.eu$" [NC]
36 RewriteRule ^(.+)$ https://www.immae.eu$1 [R=302,L]
37
f759f52e 38 <Directory ${varDir}>
0012da0f
IB
39 DirectoryIndex index.htm index.html
40 Options Indexes FollowSymLinks MultiViews Includes
41 AllowOverride All
42 Require all granted
43 </Directory>
44
45 Alias /cours ${coursDir}
46 <Directory ${coursDir}>
47 DirectoryIndex index.htm index.html
48 Options Indexes FollowSymLinks MultiViews Includes
49 AllowOverride All
50 Require all granted
51 </Directory>
52
53 Alias /recherche ${rechercheDir}
54 <Directory ${rechercheDir}>
55 DirectoryIndex index.htm index.html
f759f52e
IB
56 Options Indexes FollowSymLinks MultiViews Includes
57 AllowOverride All
58 Require all granted
59 </Directory>
f2a18fd6
IB
60
61 Alias /recettes ${recettesDir}
62 <Directory ${recettesDir}>
63 DirectoryIndex index.htm index.html
64 Options Indexes FollowSymLinks MultiViews Includes
65 AllowOverride All
66 Require all granted
67 </Directory>
f759f52e
IB
68 ''
69 ];
70 };
70606070 71
d3452fc5
IB
72 services.websites.env.production.vhostConfs.immae_fr = {
73 certName = "immae";
8cf37c75
IB
74 addToCerts = true;
75 hosts = [ "www.immae.fr" "immae.fr" ];
76 root = null;
77 extraConfig = [ ''
78 RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://www.immae.eu/chapeaux/
79 '' ];
80 };
81
d3452fc5
IB
82 services.websites.env.production.vhostConfs.immae_bouya = {
83 certName = "immae";
7df420c2 84 addToCerts = true;
70606070
IB
85 hosts = [ "bouya.org" "www.bouya.org" ];
86 root = null;
87 extraConfig = [ ''
88 RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://www.normalesup.org/~bouya/
89 '' ];
90 };
f759f52e
IB
91 };
92}