-{ pkgs, lib, writeText, fetchedGitPrivate, stdenv, composerEnv, fetchurl, fetchgit, texlive, imagemagick }:
-let
- piedsjaloux = { config }: rec {
- environment = config.environment;
- varDir = "/var/lib/piedsjaloux_${environment}";
- keys."${environment}-piedsjaloux" = {
- destDir = "/run/keys/webapps";
- user = apache.user;
- group = apache.group;
- permissions = "0700";
- text = ''
- # This file is auto-generated during the composer install
- parameters:
- database_host: ${config.mysql.host}
- database_port: ${config.mysql.port}
- 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: 127.0.0.1
- mailer_user: null
- mailer_password: null
- secret: ${config.secret}
- pdflatex: "${texlive.combine { inherit (texlive) attachfile preprint scheme-small; }}/bin/pdflatex"
- leapt_im:
- binary_path: ${imagemagick}/bin
+{ piedsjaloux, config, pkgs, lib, texlive, imagemagick }:
+rec {
+ app = piedsjaloux.override { inherit (config) environment; };
+ varDir = "/var/lib/piedsjaloux_${app.environment}";
+ keys = [{
+ dest = "webapps/${app.environment}-piedsjaloux";
+ user = apache.user;
+ group = apache.group;
+ permissions = "0400";
+ text = ''
+ # This file is auto-generated during the composer install
+ parameters:
+ database_host: ${config.mysql.host}
+ database_port: ${config.mysql.port}
+ 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: 127.0.0.1
+ mailer_user: null
+ mailer_password: null
+ secret: ${config.secret}
+ pdflatex: "${texlive.combine { inherit (texlive) attachfile preprint scheme-small; }}/bin/pdflatex"
+ leapt_im:
+ binary_path: ${imagemagick}/bin
+ '';
+ }];
+ phpFpm = rec {
+ preStart = ''
+ if [ ! -f "${app.varDir}/currentWebappDir" -o \
+ ! -f "${app.varDir}/currentKey" -o \
+ "${app}" != "$(cat ${app.varDir}/currentWebappDir 2>/dev/null)" ] \
+ || ! sha512sum -c --status ${app.varDir}/currentKey; then
+ pushd ${app} > /dev/null
+ /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=${app.environment} cache:clear --no-warmup
+ popd > /dev/null
+ echo -n "${app}" > ${app.varDir}/currentWebappDir
+ sha512sum /var/secrets/webapps/${app.environment}-piedsjaloux > ${app.varDir}/currentKey
+ fi