]>
Commit | Line | Data |
---|---|---|
1bd8b03e IB |
1 | { environment ? "prod" |
2 | , varDir ? "/var/lib/aten_${environment}" | |
db343436 | 3 | , composerEnv, fetchgit, runCommand, nodejs, jq, libsass, python, fetchurl, yarn2nix-moretea, sources }: |
1bd8b03e | 4 | let |
db343436 | 5 | packagesource = sources.websites-isabelle-aten; |
1bd8b03e | 6 | packagejson = runCommand "package.json" { buildInputs = [ jq ]; } '' |
db343436 | 7 | cat ${packagesource}/package.json | jq -r '.version = "v1.0.0"|.name="aten"' > $out |
1bd8b03e | 8 | ''; |
71b4786d | 9 | yarnModules = yarn2nix-moretea.mkYarnModules rec { |
1bd8b03e IB |
10 | name = "aten-yarn"; |
11 | pname = name; | |
12 | version = "v1.0.0"; | |
13 | packageJSON = packagejson; | |
db343436 | 14 | yarnLock = "${packagesource}/yarn.lock"; |
5145061e | 15 | yarnNix = ./yarn-packages.nix; |
1bd8b03e | 16 | pkgConfig = { |
1bd8b03e IB |
17 | node-sass = { |
18 | buildInputs = [ libsass python ]; | |
19 | postInstall = let | |
20 | nodeHeaders = fetchurl { | |
21 | url = "https://nodejs.org/download/release/v${nodejs.version}/node-v${nodejs.version}-headers.tar.gz"; | |
f5761aac | 22 | sha256 = "1prvrcvbyal39k9axfwjixs4wfgs1m8xy4prsl0kq0s0n7r7nxzj"; |
1bd8b03e IB |
23 | }; |
24 | in | |
25 | '' | |
26 | node scripts/build.js --tarball=${nodeHeaders} | |
27 | ''; | |
28 | }; | |
29 | }; | |
30 | }; | |
31 | app = composerEnv.buildPackage ( | |
32 | import ./php-packages.nix { inherit composerEnv fetchurl fetchgit; } // | |
1bd8b03e | 33 | rec { |
db343436 IB |
34 | version = packagesource.version; |
35 | pname = "aten"; | |
36 | name = "${pname}-${version}"; | |
37 | src = packagesource; | |
1bd8b03e IB |
38 | noDev = (environment == "prod"); |
39 | preInstall = '' | |
40 | export SYMFONY_ENV="${environment}" | |
41 | export APP_ENV="${environment}" | |
42 | ''; | |
43 | postInstall = '' | |
44 | ln -sf ${yarnModules}/node_modules . | |
45 | yarn run --offline encore production | |
46 | rm -rf var/{log,cache} | |
47 | ln -sf ${varDir}/{log,cache} var/ | |
48 | ''; | |
71b4786d | 49 | buildInputs = [ yarnModules yarn2nix-moretea.yarn ]; |
1bd8b03e IB |
50 | passthru = { |
51 | inherit varDir; | |
52 | inherit environment; | |
53 | webRoot = "${app}/public"; | |
54 | }; | |
55 | } | |
56 | ); | |
57 | in app |