]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - virtual/modules/websites/ludivine/ludivinecassal.nix
Purify Ludivine's website
[perso/Immae/Config/Nix.git] / virtual / modules / websites / ludivine / ludivinecassal.nix
index 342c6983a95ccf3ae30b0010d3f3ff559bf7bb37..eff0bf8f762ed34104fb825e56239df578e6b5d6 100644 (file)
@@ -1,4 +1,4 @@
-{ lib, writeText, fetchedGitPrivate, stdenv, php, git, cacert, phpPackages, ruby, sass, imagemagick }:
+{ pkgs, lib, writeText, fetchedGitPrivate, stdenv, composerEnv, fetchurl, fetchgit, ruby, sass, imagemagick }:
 let
   ludivinecassal = { config }: rec {
     environment = config.environment;
@@ -12,6 +12,7 @@ let
             database_name: ${config.mysql.name}
             database_user: ${config.mysql.user}
             database_password: ${config.mysql.password}
+            database_server_version: ${pkgs.mariadb.mysqlVersion}
             mailer_transport: smtp
             mailer_host: mail.immae.eu
             mailer_user: null
@@ -141,30 +142,24 @@ let
       fi
       '';
     };
-    webappDir = stdenv.mkDerivation (fetchedGitPrivate ./ludivinecassal.json // rec {
-      # /!\ miniatures and data need to be in the same dir due to a
-      #     bug in leapt.im (searches for data/../miniatures)
-      buildPhase = ''
-        export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
-        export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
-
-        ln -sf ${configRoot} app/config/parameters.yml
-        sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json
-        ${if environment == "dev" then ''
-          composer install
-        '' else ''
-          SYMFONY_ENV=prod composer install --no-dev
-        ''}
-        rm -rf var
-        ln -sf ../../../../../${varDir} var
-        '';
-      installPhase = ''
-        cp -a . $out
-        '';
-      buildInputs = [
-        php git cacert phpPackages.composer sass
-      ];
-    });
+    webappDir = composerEnv.buildPackage (
+      import ./php-packages.nix { inherit composerEnv fetchurl fetchgit; } //
+      fetchedGitPrivate ./ludivinecassal.json //
+      rec {
+        noDev = (environment == "prod");
+        preInstall = ''
+          export SYMFONY_ENV="${environment}"
+          ln -sf ${configRoot} app/config/parameters.yml
+          sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json
+          '';
+        # /!\ miniatures and data need to be in the same physical dir due to a
+        #     bug in leapt.im (searches for data/../miniatures)
+        postInstall = ''
+          rm -rf var/{logs,cache,data,miniatures,tmp}
+          ln -sf ../../../../../../../${varDir}/{logs,cache,data,miniatures,tmp} var/
+          '';
+        buildInputs = [ sass ];
+      });
     webRoot = "${webappDir}/web";
   };
 in