aboutsummaryrefslogblamecommitdiff
path: root/modules/private/websites/capitaines/landing_pages.nix
blob: edba8b90ba7162224bd96f587d425f51f6520d6d (plain) (tree)
1
2
3
4
5
6
7
8
9


                                                            





                                                                                                                       



                                                                           
                                       


                                     
                                        







                                                            



                                                                        
                                        


                                     
                                         











                                                              
                           
                        
                              






                                  
{ lib, config,  ... }:
let
  cfg = config.myServices.websites.capitaines.landing_pages;
  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.env.production.vhostConfs.capitaines_mastodon = rec {
      inherit certName;
      certMainHost = "mastodon.${domain}";
      hosts        = [ certMainHost ];
      root         = ./mastodon_static;
      extraConfig  = [
        ''
        ErrorDocument 404 /index.html
        <Directory ${./mastodon_static}>
          DirectoryIndex index.html
          Options Indexes FollowSymLinks MultiViews Includes
          Require all granted
        </Directory>
          ''
      ];
    };

    services.websites.env.production.vhostConfs.capitaines_discourse = {
      inherit certName;
      addToCerts   = true;
      hosts        = [ "discourse.${domain}" ];
      root         = ./discourse_static;
      extraConfig  = [
        ''
        ErrorDocument 404 /index.html
        <Directory ${./discourse_static}>
          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       = ../_www;
      extraConfig = [ ''
        <Directory ${../_www}>
          DirectoryIndex index.htm
          Require all granted
        </Directory>
        '' ];
    };
  };
}