aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/capitaines/production.nix
blob: 044ff1d04b56137f5e443bf3725b23e581384960 (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
{ lib, pkgs, config,  ... }:
let
    cfg = config.myServices.websites.capitaines.production;
    env = config.myEnv.websites.capitaines;
    webappName = "capitaines_mastodon";
    root = "/run/current-system/webapps/${webappName}";
    siteDir = ./mastodon_static;
in {
  options.myServices.websites.capitaines.production.enable = lib.mkEnableOption "enable Capitaines's website";

  config = lib.mkIf cfg.enable {
    myServices.websites.webappDirs."${webappName}" = siteDir;

    services.websites.env.production.vhostConfs.capitaines_mastodon = {
      certName     = "capitaines";
      certMainHost = "mastodon.capitaines.fr";
      hosts        = [ "mastodon.capitaines.fr" ];
      root         = root;
      extraConfig  = [
        ''
        ErrorDocument 404 /index.html
        <Directory ${root}>
          DirectoryIndex index.html
          Options Indexes FollowSymLinks MultiViews Includes
          Require all granted
        </Directory>
          ''
      ];
    };

    services.websites.env.production.vhostConfs.capitaines = {
      certName   = "capitaines";
      addToCerts = true;
      hosts      = [ "capitaines.fr" ];
      root       = "/run/current-system/webapps/_www";
      extraConfig = [ ''
        <Directory /run/current-system/webapps/_www>
          DirectoryIndex index.htm
          Require all granted
        </Directory>
        '' ];
    };
  };
}