]>
Commit | Line | Data |
---|---|---|
1a64deeb | 1 | { fetchgit, runCommand, callPackage, mylibs, nodePackages, nodejs_16, git }: |
f036e975 IB |
2 | let |
3 | source = fetchgit { | |
4 | url = "https://github.com/bafolts/terraforming-mars"; | |
5 | rev = "25b3f80e276cc0c1fc283a78b6ae94b13c545ab6"; | |
6 | sha256 = "03xcwvxv2mlmswngklzqp3lf30hgkvdilqq7p1z4h8xmy50cy12k"; | |
7 | leaveDotGit = true; | |
8 | fetchSubmodules = true; | |
9 | }; | |
10 | patchedSource = runCommand "patch-source" {} '' | |
11 | cp -r ${source} $out | |
12 | chmod -R u+w $out | |
13 | sed -i -e 's/"lockfileVersion": 2,/"lockfileVersion": 1,/' $out/package-lock.json | |
14 | ''; | |
15 | packages = callPackage ./node-packages.nix { | |
16 | src = patchedSource; | |
1a64deeb IB |
17 | nodeEnv = callPackage mylibs.nodeEnv { nodejs = nodejs_16; }; |
18 | globalBuildInputs = [ nodejs_16.pkgs.node-pre-gyp ]; | |
f036e975 IB |
19 | }; |
20 | terraforming-mars = runCommand "terraforming-mars" { | |
1a64deeb | 21 | buildInputs = [ nodejs_16 git ]; |
f036e975 IB |
22 | } '' |
23 | cp -r ${source} ./source | |
24 | chmod -R u+w source | |
25 | cd source | |
1a64deeb | 26 | patch -p1 < ${./immae-assets.patch} |
f036e975 | 27 | ln -s ${packages.package}/lib/node_modules/terraforming-mars/node_modules . |
1a64deeb IB |
28 | # See https://stackoverflow.com/questions/74548318/how-to-resolve-error-error0308010cdigital-envelope-routinesunsupported-no |
29 | export NODE_OPTIONS=--openssl-legacy-provider | |
f036e975 IB |
30 | npm run build |
31 | mkdir $out | |
32 | cp -a build $out/ | |
33 | cp -a assets $out/ | |
34 | cp package.json $out/ | |
35 | ln -s ${packages.package}/lib/node_modules/terraforming-mars/node_modules $out | |
36 | ln -s /var/lib/terraforming-mars/db $out/db | |
37 | ''; | |
38 | in | |
39 | terraforming-mars |