diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-23 12:05:28 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-23 12:06:29 +0100 |
commit | d78128ecd759db7aa86727fc08068a23e223b0ff (patch) | |
tree | 788bda29b80a157cc20ccf3af50963129c3b1caa /virtual/modules/websites/connexionswing/connexionswing.nix | |
parent | a718b966d80612cf9973da82d8fa8c632b21b152 (diff) | |
download | Nix-d78128ecd759db7aa86727fc08068a23e223b0ff.tar.gz Nix-d78128ecd759db7aa86727fc08068a23e223b0ff.tar.zst Nix-d78128ecd759db7aa86727fc08068a23e223b0ff.zip |
Purify connexionswing website
Diffstat (limited to 'virtual/modules/websites/connexionswing/connexionswing.nix')
-rw-r--r-- | virtual/modules/websites/connexionswing/connexionswing.nix | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/virtual/modules/websites/connexionswing/connexionswing.nix b/virtual/modules/websites/connexionswing/connexionswing.nix index 66c9b53..ecbbfd5 100644 --- a/virtual/modules/websites/connexionswing/connexionswing.nix +++ b/virtual/modules/websites/connexionswing/connexionswing.nix | |||
@@ -1,9 +1,8 @@ | |||
1 | { lib, writeText, fetchedGitPrivate, stdenv, php, git, cacert }: | 1 | { pkgs, lib, writeText, fetchedGitPrivate, stdenv, composerEnv, fetchurl, fetchgit }: |
2 | let | 2 | let |
3 | connexionswing = { config }: rec { | 3 | connexionswing = { config }: rec { |
4 | environment = config.environment; | 4 | environment = config.environment; |
5 | varDir = "/var/lib/connexionswing_${environment}"; | 5 | varDir = "/var/lib/connexionswing_${environment}"; |
6 | envName= lib.strings.toUpper environment; | ||
7 | configRoot = | 6 | configRoot = |
8 | writeText "parameters.yml" '' | 7 | writeText "parameters.yml" '' |
9 | # This file is auto-generated during the composer install | 8 | # This file is auto-generated during the composer install |
@@ -13,6 +12,7 @@ let | |||
13 | database_name: ${config.mysql.name} | 12 | database_name: ${config.mysql.name} |
14 | database_user: ${config.mysql.user} | 13 | database_user: ${config.mysql.user} |
15 | database_password: ${config.mysql.password} | 14 | database_password: ${config.mysql.password} |
15 | database_server_version: ${pkgs.mariadb.mysqlVersion} | ||
16 | mailer_transport: smtp | 16 | mailer_transport: smtp |
17 | mailer_host: mail.immae.eu | 17 | mailer_host: mail.immae.eu |
18 | mailer_user: null | 18 | mailer_user: null |
@@ -143,28 +143,24 @@ let | |||
143 | fi | 143 | fi |
144 | ''; | 144 | ''; |
145 | }; | 145 | }; |
146 | webappDir = stdenv.mkDerivation (fetchedGitPrivate ./connexionswing.json // rec { | 146 | webappDir = composerEnv.buildPackage ( |
147 | buildPhase = '' | 147 | import ./php-packages.nix { inherit composerEnv fetchurl fetchgit; } // |
148 | export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt | 148 | fetchedGitPrivate ./connexionswing.json // |
149 | export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt | 149 | rec { |
150 | 150 | noDev = (environment == "prod"); | |
151 | ln -sf ../../../../../${varDir}/{medias,uploads} web/images/ | 151 | preInstall = '' |
152 | ln -sf ${configRoot} app/config/parameters.yml | 152 | export SYMFONY_ENV="${environment}" |
153 | sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json | 153 | ''; |
154 | ${if environment == "dev" then "php bin/composer install" else '' | 154 | postInstall = '' |
155 | SYMFONY_ENV=prod php bin/composer install --no-dev | 155 | cd $out |
156 | ./bin/console assetic:dump --env=prod --no-debug | 156 | ${if environment == "prod" then "php ./bin/console assetic:dump --env=prod --no-debug" else ""} |
157 | ''} | 157 | rm app/config/parameters.yml |
158 | rm -rf var | 158 | ln -sf ${configRoot} app/config/parameters.yml |
159 | ln -sf ../../../../../${varDir}/var var | 159 | rm -rf var/{logs,cache} |
160 | ''; | 160 | ln -sf ../../../../../../${varDir}/var/{logs,cache} var/ |
161 | installPhase = '' | 161 | ln -sf ../../../../../${varDir}/{medias,uploads} web/images/ |
162 | cp -a . $out | 162 | ''; |
163 | ''; | 163 | }); |
164 | buildInputs = [ | ||
165 | php git cacert | ||
166 | ]; | ||
167 | }); | ||
168 | webRoot = "${webappDir}/web"; | 164 | webRoot = "${webappDir}/web"; |
169 | }; | 165 | }; |
170 | in | 166 | in |