From d3452fc59b9839846225fd254926c64a9c71f071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 18 Apr 2020 16:10:56 +0200 Subject: Refactor websites --- .../private/websites/capitaines/landing_pages.nix | 60 +++++++++++++++++++++ modules/private/websites/capitaines/production.nix | 62 ---------------------- 2 files changed, 60 insertions(+), 62 deletions(-) create mode 100644 modules/private/websites/capitaines/landing_pages.nix delete mode 100644 modules/private/websites/capitaines/production.nix (limited to 'modules/private/websites/capitaines') diff --git a/modules/private/websites/capitaines/landing_pages.nix b/modules/private/websites/capitaines/landing_pages.nix new file mode 100644 index 0000000..b94a398 --- /dev/null +++ b/modules/private/websites/capitaines/landing_pages.nix @@ -0,0 +1,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 + + 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 + + '' ]; + }; + }; +} diff --git a/modules/private/websites/capitaines/production.nix b/modules/private/websites/capitaines/production.nix deleted file mode 100644 index ee1698b..0000000 --- a/modules/private/websites/capitaines/production.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ lib, pkgs, config, ... }: -let - cfg = config.myServices.websites.capitaines.production; - env = config.myEnv.websites.capitaines; -in { - options.myServices.websites.capitaines.production.enable = lib.mkEnableOption "enable Capitaines's website"; - - config = lib.mkIf cfg.enable { - myServices.websites.webappDirs.capitaines_mastodon = ./mastodon_static; - services.websites.env.production.vhostConfs.capitaines_mastodon = let - root = "/run/current-system/webapps/capitaines_mastodon"; - in { - certName = "capitaines"; - certMainHost = "mastodon.capitaines.fr"; - hosts = [ "mastodon.capitaines.fr" ]; - root = root; - extraConfig = [ - '' - ErrorDocument 404 /index.html - - DirectoryIndex index.html - Options Indexes FollowSymLinks MultiViews Includes - Require all granted - - '' - ]; - }; - - myServices.websites.webappDirs.capitaines_discourse = ./discourse_static; - services.websites.env.production.vhostConfs.capitaines_discourse = let - root = "/run/current-system/webapps/capitaines_discourse"; - in { - certName = "capitaines"; - addToCerts = true; - hosts = [ "discourse.capitaines.fr" ]; - root = root; - extraConfig = [ - '' - ErrorDocument 404 /index.html - - DirectoryIndex index.html - Options Indexes FollowSymLinks MultiViews Includes - Require all granted - - '' - ]; - }; - - services.websites.env.production.vhostConfs.capitaines = { - certName = "capitaines"; - addToCerts = true; - hosts = [ "capitaines.fr" ]; - root = "/run/current-system/webapps/_www"; - extraConfig = [ '' - - DirectoryIndex index.htm - Require all granted - - '' ]; - }; - }; -} -- cgit v1.2.3