]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/connexionswing/app/default.nix
Migrate mylibs to niv (work in progress)
[perso/Immae/Config/Nix.git] / modules / private / websites / connexionswing / app / default.nix
1 { environment ? "prod"
2 , varDir ? "/var/lib/connexionswing_${environment}"
3 , secretsPath ? "/var/secrets/webapps/${environment}-connexionswing"
4 , composerEnv, fetchurl, fetchgit, sources }:
5 let
6 app = composerEnv.buildPackage (
7 import ./php-packages.nix { inherit composerEnv fetchurl fetchgit; } //
8 rec {
9 pname = "connexionswing";
10 name = "${pname}-${version}";
11 version = sources.websites-connexionswing-app.version;
12 src = sources.websites-connexionswing-app;
13 noDev = (environment == "prod");
14 preInstall = ''
15 export SYMFONY_ENV="${environment}"
16 '';
17 postInstall = ''
18 cd $out
19 ${if environment == "prod" then "php ./bin/console assetic:dump --env=prod --no-debug" else ""}
20 rm app/config/parameters.yml
21 ln -sf ${secretsPath} app/config/parameters.yml
22 rm -rf var/{logs,cache}
23 ln -sf ${varDir}/var/{logs,cache} var/
24 ln -sf ${varDir}/{medias,uploads} web/images/
25 '';
26 passthru = {
27 inherit varDir environment;
28 webRoot = "${app}/web";
29 };
30 });
31 in app