aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/capitaines
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-04-18 16:10:56 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-04-20 01:51:48 +0200
commitd3452fc59b9839846225fd254926c64a9c71f071 (patch)
treea98a0958b826ac4b2ab137720edf0195c65dd958 /modules/private/websites/capitaines
parent514f9ec3beec470c4445be690673a0ceab9115b4 (diff)
downloadNix-d3452fc59b9839846225fd254926c64a9c71f071.tar.gz
Nix-d3452fc59b9839846225fd254926c64a9c71f071.tar.zst
Nix-d3452fc59b9839846225fd254926c64a9c71f071.zip
Refactor websites
Diffstat (limited to 'modules/private/websites/capitaines')
-rw-r--r--modules/private/websites/capitaines/landing_pages.nix60
-rw-r--r--modules/private/websites/capitaines/production.nix62
2 files changed, 60 insertions, 62 deletions
diff --git a/modules/private/websites/capitaines/landing_pages.nix b/modules/private/websites/capitaines/landing_pages.nix
new file mode 100644
index 0000000..b94a398
--- /dev/null
+++ b/modules/private/websites/capitaines/landing_pages.nix
@@ -0,0 +1,60 @@
1{ lib, config, ... }:
2let
3 cfg = config.myServices.websites.capitaines.landing_pages;
4 webappdirs = config.services.websites.webappDirsPaths;
5 certName = "capitaines";
6 domain = "capitaines.fr";
7in {
8 options.myServices.websites.capitaines.landing_pages.enable = lib.mkEnableOption "enable Capitaines's landing pages";
9
10 config = lib.mkIf cfg.enable {
11 services.websites.webappDirs.capitaines_mastodon = ./mastodon_static;
12 services.websites.env.production.vhostConfs.capitaines_mastodon = rec {
13 inherit certName;
14 certMainHost = "mastodon.${domain}";
15 hosts = [ certMainHost ];
16 root = webappdirs.capitaines_mastodon;
17 extraConfig = [
18 ''
19 ErrorDocument 404 /index.html
20 <Directory ${webappdirs.capitaines_mastodon}>
21 DirectoryIndex index.html
22 Options Indexes FollowSymLinks MultiViews Includes
23 Require all granted
24 </Directory>
25 ''
26 ];
27 };
28
29 services.websites.webappDirs.capitaines_discourse = ./discourse_static;
30 services.websites.env.production.vhostConfs.capitaines_discourse = {
31 inherit certName;
32 addToCerts = true;
33 hosts = [ "discourse.${domain}" ];
34 root = webappdirs.capitaines_discourse;
35 extraConfig = [
36 ''
37 ErrorDocument 404 /index.html
38 <Directory ${webappdirs.capitaines_discourse}>
39 DirectoryIndex index.html
40 Options Indexes FollowSymLinks MultiViews Includes
41 Require all granted
42 </Directory>
43 ''
44 ];
45 };
46
47 services.websites.env.production.vhostConfs.capitaines = {
48 inherit certName;
49 addToCerts = true;
50 hosts = [ domain ];
51 root = webappdirs._www;
52 extraConfig = [ ''
53 <Directory ${webappdirs._www}>
54 DirectoryIndex index.htm
55 Require all granted
56 </Directory>
57 '' ];
58 };
59 };
60}
diff --git a/modules/private/websites/capitaines/production.nix b/modules/private/websites/capitaines/production.nix
deleted file mode 100644
index ee1698b..0000000
--- a/modules/private/websites/capitaines/production.nix
+++ /dev/null
@@ -1,62 +0,0 @@
1{ lib, pkgs, config, ... }:
2let
3 cfg = config.myServices.websites.capitaines.production;
4 env = config.myEnv.websites.capitaines;
5in {
6 options.myServices.websites.capitaines.production.enable = lib.mkEnableOption "enable Capitaines's website";
7
8 config = lib.mkIf cfg.enable {
9 myServices.websites.webappDirs.capitaines_mastodon = ./mastodon_static;
10 services.websites.env.production.vhostConfs.capitaines_mastodon = let
11 root = "/run/current-system/webapps/capitaines_mastodon";
12 in {
13 certName = "capitaines";
14 certMainHost = "mastodon.capitaines.fr";
15 hosts = [ "mastodon.capitaines.fr" ];
16 root = root;
17 extraConfig = [
18 ''
19 ErrorDocument 404 /index.html
20 <Directory ${root}>
21 DirectoryIndex index.html
22 Options Indexes FollowSymLinks MultiViews Includes
23 Require all granted
24 </Directory>
25 ''
26 ];
27 };
28
29 myServices.websites.webappDirs.capitaines_discourse = ./discourse_static;
30 services.websites.env.production.vhostConfs.capitaines_discourse = let
31 root = "/run/current-system/webapps/capitaines_discourse";
32 in {
33 certName = "capitaines";
34 addToCerts = true;
35 hosts = [ "discourse.capitaines.fr" ];
36 root = root;
37 extraConfig = [
38 ''
39 ErrorDocument 404 /index.html
40 <Directory ${root}>
41 DirectoryIndex index.html
42 Options Indexes FollowSymLinks MultiViews Includes
43 Require all granted
44 </Directory>
45 ''
46 ];
47 };
48
49 services.websites.env.production.vhostConfs.capitaines = {
50 certName = "capitaines";
51 addToCerts = true;
52 hosts = [ "capitaines.fr" ];
53 root = "/run/current-system/webapps/_www";
54 extraConfig = [ ''
55 <Directory /run/current-system/webapps/_www>
56 DirectoryIndex index.htm
57 Require all granted
58 </Directory>
59 '' ];
60 };
61 };
62}