aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/piedsjaloux/app/default.nix
blob: a3d48bd2ed6e184db3f02495cfc2597b353e1dd3 (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
{ environment ? "prod"
, varDir ? "/var/lib/piedsjaloux_${environment}"
, secretsPath ? "/var/secrets/webapps/${environment}-piedsjaloux"
, composerEnv, fetchurl, fetchgit, sources }:
let
  app = composerEnv.buildPackage (
    import ./php-packages.nix { inherit composerEnv fetchurl fetchgit; } //
    rec {
      version = sources.websites-piedsjaloux-app.version;
      pname = "piedsjaloux";
      name = "${pname}-${version}";
      src = sources.websites-piedsjaloux-app;
      noDev = (environment == "prod");
      preInstall = ''
        export SYMFONY_ENV="${environment}"
        '';
      # /!\ miniatures and data need to be in the same physical dir due to a
      #     bug in leapt.im (searches for data/../miniatures)
      postInstall = ''
        cd $out
        rm app/config/parameters.yml
        ln -sf ${secretsPath} app/config/parameters.yml
        rm -rf var/{logs,cache,data,miniatures,tmp}
        ln -sf ${varDir}/{logs,cache,data,miniatures,tmp} var/
        '';
        passthru = {
          inherit varDir environment secretsPath;
          webRoot = "${app}/web";
      };
    });
in app