aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/capitaines/landing_pages.nix
blob: b94a39805163eb03edcad06a491ea33925dae454 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib, config,  ... }:
let
  cfg = config.myServices.websites.capitaines.landing_pages;
  webappdirs = config.services.websites.webappDirsPaths;
  certName = "capitaines";
  domain = "capitaines.fr";
in {
  options.myServices.websites.capitaines.landing_pages.enable = lib.mkEnableOption "enable Capitaines's landing pages";

  config = lib.mkIf cfg.enable {
    services.websites.webappDirs.capitaines_mastodon = ./mastodon_static;
    services.websites.env.production.vhostConfs.capitaines_mastodon = rec {
      inherit certName;
      certMainHost = "mastodon.${domain}";
      hosts        = [ certMainHost ];
      root         = webappdirs.capitaines_mastodon;
      extraConfig  = [
        ''
        ErrorDocument 404 /index.html
        <Directory ${webappdirs.capitaines_mastodon}>
          DirectoryIndex index.html
          Options Indexes FollowSymLinks MultiViews Includes
          Require all granted
        </Directory>
          ''
      ];
    };

    services.websites.webappDirs.capitaines_discourse = ./discourse_static;
    services.websites.env.production.vhostConfs.capitaines_discourse = {
      inherit certName;
      addToCerts   = true;
      hosts        = [ "discourse.${domain}" ];
      root         = webappdirs.capitaines_discourse;
      extraConfig  = [
        ''
        ErrorDocument 404 /index.html
        <Directory ${webappdirs.capitaines_discourse}>
          DirectoryIndex index.html
          Options Indexes FollowSymLinks MultiViews Includes
          Require all granted
        </Directory>
          ''
      ];
    };

    services.websites.env.production.vhostConfs.capitaines = {
      inherit certName;
      addToCerts = true;
      hosts      = [ domain ];
      root       = webappdirs._www;
      extraConfig = [ ''
        <Directory ${webappdirs._www}>
          DirectoryIndex index.htm
          Require all granted
        </Directory>
        '' ];
    };
  };
}