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