]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/tools/tools/default.nix
Migrate manual scripts from tools.immae.eu
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / default.nix
index 2fe477592e580d38585d8a4c1bcb7cb78ff9e8dd..dbd65e63ffdb76fcaba36ea56a8368131c74d5b7 100644 (file)
@@ -38,6 +38,11 @@ let
   grocy = pkgs.callPackage ./grocy.nix {
     inherit (pkgs.webapps) grocy;
   };
+  webhooks = pkgs.callPackage ./webhooks.nix {
+    env = config.myEnv.tools.webhooks;
+  };
+
+  landing = pkgs.callPackage ./landing.nix {};
 
   cfg = config.myServices.websites.tools.tools;
   pcfg = config.services.phpfpm.pools;
@@ -53,7 +58,8 @@ in {
       ++ shaarli.keys
       ++ ttrss.keys
       ++ wallabag.keys
-      ++ yourls.keys;
+      ++ yourls.keys
+      ++ webhooks.keys;
 
     services.duplyBackup.profiles = {
       dokuwiki = dokuwiki.backups;
@@ -111,9 +117,16 @@ in {
           RedirectMatch 301 ^/roundcube(.*)$   https://mail.immae.eu/roundcube$1
           RedirectMatch 301 ^/jappix(.*)$      https://im.immae.fr/converse
 
-          RewriteEngine On
-          RewriteCond %{DOCUMENT_ROOT}/homer%{REQUEST_URI} -f
-          RewriteRule ^(.*)$ /homer$1 [QSA,L]
+          Alias /landing ${landing}
+          <Directory "${landing}">
+            DirectoryIndex index.html
+            AllowOverride None
+            Require all granted
+
+            <FilesMatch "\.php$">
+              SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost"
+            </FilesMatch>
+          </Directory>
 
           <Directory "/var/lib/ftp/tools.immae.eu">
             DirectoryIndex index.php index.htm index.html
@@ -122,6 +135,11 @@ in {
             <FilesMatch "\.php$">
               SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost"
             </FilesMatch>
+
+            RewriteEngine On
+            RewriteCond ${landing}%{REQUEST_URI} -f
+            RewriteRule ^(.*)$ /landing/$1 [L]
+            RewriteRule ^$ /landing/ [L]
           </Directory>
           ''
         (adminer.apache.vhostConf pcfg.adminer.socket)
@@ -143,6 +161,23 @@ in {
             Require all granted
             Options -Indexes
           </Directory>
+
+          Alias /BIP39 /var/lib/buildbot/outputs/bip39
+          <Directory "/var/lib/buildbot/outputs/bip39">
+            DirectoryIndex index.html
+            AllowOverride None
+            Require all granted
+          </Directory>
+
+          Alias /webhooks ${config.secrets.location}/webapps/webhooks
+          <Directory "${config.secrets.location}/webapps/webhooks">
+            Options -Indexes
+            Require all granted
+            AllowOverride None
+            <FilesMatch "\.php$">
+              SetHandler "proxy:unix:${pcfg.tools.socket}|fcgi://localhost"
+            </FilesMatch>
+          </Directory>
         ''
       ];
     };
@@ -253,7 +288,13 @@ in {
 
           # Needed to avoid clashes in browser cookies (same domain)
           "php_value[session.name]" = "ToolsPHPSESSID";
-          "php_admin_value[open_basedir]" = "/run/wrappers/bin/sendmail:/var/lib/ftp/tools.immae.eu:/tmp";
+          "php_admin_value[open_basedir]" = builtins.concatStringsSep ":" [
+            "/run/wrappers/bin/sendmail" "/var/lib/ftp/tools.immae.eu"
+            landing "/tmp" "${config.secrets.location}/webapps/webhooks"
+          ];
+        };
+        phpEnv = {
+          CONTACT_EMAIL = config.myEnv.tools.contact;
         };
       };
       devtools = {