aboutsummaryrefslogblamecommitdiff
path: root/pkgs/private/webapps/ludivinecassal/default.nix
blob: 34014352d141a30c4aea847dd497de0db5426517 (plain) (tree)


































                                                                                                
{ environment ? "prod"
, varDir ? "/var/lib/ludivinecassal_${environment}"
, composerEnv, fetchurl, fetchgit, imagemagick, sass, ruby, mylibs }:
let
  app = composerEnv.buildPackage (
    import ./php-packages.nix { inherit composerEnv fetchurl fetchgit; } //
    mylibs.fetchedGitPrivate ./ludivinecassal.json //
    rec {
      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 /var/secrets/webapps/${environment}-ludivinecassal app/config/parameters.yml
        '';
      buildInputs = [ sass ];
      passthru = {
        inherit varDir environment;
        webRoot = "${app}/web";
      };
    });
in app