]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/ludivine/app/default.nix
05be0b1a5502e26aa8c24bddd238afb77b2b76ee
[perso/Immae/Config/Nix.git] / modules / private / websites / ludivine / app / default.nix
1 { environment ? "prod"
2 , varDir ? "/var/lib/ludivinecassal_${environment}"
3 , secretsPath ? "/var/secrets/webapps/${environment}-ludivinecassal"
4 , composerEnv, fetchurl, fetchgit, imagemagick, sass, ruby, mylibs }:
5 let
6 app = composerEnv.buildPackage (
7 import ./php-packages.nix { inherit composerEnv fetchurl fetchgit; } //
8 mylibs.fetchedGitPrivate ./ludivinecassal.json //
9 rec {
10 noDev = (environment == "prod");
11 preInstall = ''
12 export SYMFONY_ENV="${environment}"
13 cp app/config/parameters.yml.dist app/config/parameters.yml
14 cat >> app/config/parameters.yml <<EOF
15 leapt_im:
16 binary_path: ${imagemagick}/bin
17 assetic:
18 sass: ${sass}/bin/sass
19 ruby: ${ruby}/bin/ruby
20 EOF
21 sed -i -e "/Incenteev..ParameterHandler..ScriptHandler::buildParameters/d" composer.json
22 '';
23 # /!\ miniatures and data need to be in the same physical dir due to a
24 # bug in leapt.im (searches for data/../miniatures)
25 postInstall = ''
26 rm -rf var/{logs,cache,data,miniatures,tmp}
27 ln -sf ${varDir}/{logs,cache,data,miniatures,tmp} var/
28 ln -sf ${secretsPath} app/config/parameters.yml
29 '';
30 buildInputs = [ sass ];
31 passthru = {
32 inherit varDir environment;
33 webRoot = "${app}/web";
34 };
35 });
36 in app