]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/ludivine/integration.nix
Refactor websites
[perso/Immae/Config/Nix.git] / modules / private / websites / ludivine / integration.nix
similarity index 77%
rename from modules/private/websites/ludivinecassal/integration.nix
rename to modules/private/websites/ludivine/integration.nix
index d304fdf9e76b390cdc76561b0535079b22a6103c..4e37c0cb846fe3eee7166b02ae57041d19e6f838 100644 (file)
@@ -1,15 +1,19 @@
 { lib, pkgs, config,  ... }:
 let
-  secrets = config.myEnv.websites.ludivinecassal.integration;
-  app = pkgs.webapps.ludivinecassal.override { environment = secrets.environment; };
-  cfg = config.myServices.websites.ludivinecassal.integration;
+  secrets = config.myEnv.websites.ludivine.integration;
+  app = pkgs.callPackage ./app {
+    environment = secrets.environment;
+    varDir = "/var/lib/ludivine_integration";
+    secretsPath = config.secrets.fullPaths."websites/ludivine/integration";
+  };
+  cfg = config.myServices.websites.ludivine.integration;
   pcfg = config.services.phpApplication;
 in {
-  options.myServices.websites.ludivinecassal.integration.enable = lib.mkEnableOption "enable Ludivine's website in integration";
+  options.myServices.websites.ludivine.integration.enable = lib.mkEnableOption "enable Ludivine's website in integration";
 
   config = lib.mkIf cfg.enable {
-    services.duplyBackup.profiles.ludivinecassal_dev.rootDir = app.varDir;
-    services.phpApplication.apps.ludivinecassal_dev = {
+    services.duplyBackup.profiles.ludivine_integration.rootDir = app.varDir;
+    services.phpApplication.apps.ludivine_integration = {
       websiteEnv = "integration";
       httpdUser = config.services.httpd.Inte.user;
       httpdGroup = config.services.httpd.Inte.group;
@@ -32,16 +36,21 @@ in {
         "pm.process_idle_timeout" = "60";
       };
       phpEnv = {
-        SYMFONY_DEBUG_MODE = "yes";
+        PATH = lib.makeBinPath [
+          # below ones don't need to be in the PATH but they’re used in
+          # secrets
+          pkgs.imagemagick pkgs.sass pkgs.ruby
+        ];
+        SYMFONY_DEBUG_MODE = "\"yes\"";
       };
       phpWatchFiles = [
-        config.secrets.fullPaths."webapps/${app.environment}-ludivinecassal"
+        config.secrets.fullPaths."websites/ludivine/integration"
       ];
     };
 
     secrets.keys = [
       {
-        dest = "webapps/${app.environment}-ludivinecassal";
+        dest = "websites/ludivine/integration";
         user = config.services.httpd.Inte.user;
         group = config.services.httpd.Inte.group;
         permissions = "0400";
@@ -78,15 +87,15 @@ in {
       }
     ];
 
-    services.websites.env.integration.vhostConfs.ludivinecassal_dev = {
-      certName     = "integration";
+    services.websites.env.integration.vhostConfs.ludivine_integration = {
+      certName    = "integration";
       addToCerts  = true;
       hosts       = [ "ludivine.immae.eu" ];
-      root        = pcfg.webappDirs.ludivinecassal_dev;
+      root        = pcfg.webappDirs.ludivine_integration;
       extraConfig = [
         ''
         <FilesMatch "\.php$">
-          SetHandler "proxy:unix:${pcfg.phpListenPaths.ludivinecassal_dev}|fcgi://localhost"
+          SetHandler "proxy:unix:${pcfg.phpListenPaths.ludivine_integration}|fcgi://localhost"
         </FilesMatch>
 
         <Location />
@@ -95,7 +104,7 @@ in {
           ErrorDocument 401 "<html><meta http-equiv=\"refresh\" content=\"0;url=https://ludivinecassal.com\"></html>"
         </Location>
 
-        <Directory ${pcfg.webappDirs.ludivinecassal_dev}>
+        <Directory ${pcfg.webappDirs.ludivine_integration}>
           Options Indexes FollowSymLinks MultiViews Includes
           AllowOverride None
           Require all granted