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