aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites/capitaines/default.nix
blob: 7f8f4c6370874d34ee5b97d1691d26f20920cf25 (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
{ lib, pkgs, config, myconfig, mylibs, ... }:
let
    cfg = config.services.myWebsites.Capitaines;
    env = myconfig.env.websites.capitaines;
    siteDir = ./mastodon_static;
in {
  options.services.myWebsites.Capitaines = {
    production = {
      enable = lib.mkEnableOption "enable Capitaines's website";
    };
  };

  config = lib.mkIf cfg.production.enable {
    security.acme.certs."capitaines_mastodon" = config.services.myCertificates.certConfig // {
      domain = "mastodon.capitaines.fr";
    };

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