-{ 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;
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
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