{ 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 DirectoryIndex index.html Options Indexes FollowSymLinks MultiViews Includes Require all granted '' ]; }; 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 DirectoryIndex index.html Options Indexes FollowSymLinks MultiViews Includes Require all granted '' ]; }; services.websites.env.production.vhostConfs.capitaines = { inherit certName; addToCerts = true; hosts = [ domain ]; root = webappdirs._www; extraConfig = [ '' DirectoryIndex index.htm Require all granted '' ]; }; }; }