]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/capitaines/production.nix
Add missing domain to mail-rsa
[perso/Immae/Config/Nix.git] / modules / private / websites / capitaines / production.nix
index fe9c619491d5a7752032a486b72cd52ba856f1e2..ee1698b0b5aca4f66d960019e58d19cdd6bf122b 100644 (file)
@@ -1,20 +1,15 @@
-{ lib, pkgs, config, myconfig,  ... }:
+{ lib, pkgs, config,  ... }:
 let
-    cfg = config.myServices.websites.capitaines.production;
-    env = myconfig.env.websites.capitaines;
-    webappName = "capitaines_mastodon";
-    root = "/run/current-system/webapps/${webappName}";
-    siteDir = ./mastodon_static;
+  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 {
-    system.extraSystemBuilderCmds = ''
-      mkdir -p $out/webapps
-      ln -s ${siteDir} $out/webapps/${webappName}
-      '';
-
-    services.websites.production.vhostConfs.capitaines_mastodon = {
+    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" ];
@@ -31,7 +26,27 @@ in {
       ];
     };
 
-    services.websites.production.vhostConfs.capitaines = {
+    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
+        <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" ];