]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/ludivine/app/default.nix
Refactor websites
[perso/Immae/Config/Nix.git] / modules / private / websites / ludivine / app / default.nix
CommitLineData
b3c0779f
IB
1{ environment ? "prod"
2, varDir ? "/var/lib/ludivinecassal_${environment}"
d3452fc5 3, secretsPath ? "/var/secrets/webapps/${environment}-ludivinecassal"
b3c0779f
IB
4, composerEnv, fetchurl, fetchgit, imagemagick, sass, ruby, mylibs }:
5let
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/
d3452fc5 28 ln -sf ${secretsPath} app/config/parameters.yml
b3c0779f
IB
29 '';
30 buildInputs = [ sass ];
31 passthru = {
32 inherit varDir environment;
33 webRoot = "${app}/web";
34 };
35 });
36in app