]> 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 d88763c198544066d30af915d8ef0766710a7de7..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,6 +117,17 @@ in {
           RedirectMatch 301 ^/roundcube(.*)$   https://mail.immae.eu/roundcube$1
           RedirectMatch 301 ^/jappix(.*)$      https://im.immae.fr/converse
 
+          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
             AllowOverride all
@@ -118,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)
@@ -139,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>
         ''
       ];
     };
@@ -249,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 = {
@@ -335,7 +380,7 @@ in {
       ldap = ldap.activationScript;
     };
 
-    myServices.websites.webappDirs = {
+    services.websites.webappDirs = {
       _adminer = adminer.webRoot;
       "${dokuwiki.apache.webappName}" = dokuwiki.webRoot;
       "${ldap.apache.webappName}" = "${ldap.webRoot}/htdocs";