aboutsummaryrefslogtreecommitdiff
path: root/uploader/default.nix
blob: 58e10c0196f216737e68344ccd8d8da4d9881db3 (plain)
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
38
workadventuresrc:

{ stdenv
, fetchFromGitHub
, makeWrapper
, mkYarnPackage
, nodejs-14_x
, workadventure
, yarn2nix-moretea
, ... }:

yarn2nix-moretea.mkYarnPackage rec {
  pname = "workadventureuploader";
  version = "unstable";

  src = "${workadventuresrc}/uploader";

  # NOTE: this is optional and generated dynamically if omitted
  yarnNix = ./yarn.nix;

  nativeBuildInputs = [ makeWrapper ];

  dontStrip = true;

  buildPhase = ''
    mkdir -p $out
    # ln -s ${workadventure.messages.outPath}/generated deps/workadventureback/src/Messages/generated
    HOME=$TMPDIR yarn --offline run tsc
    cp -r deps/workadventureback/dist $out/dist
  '';

  postInstall = ''
    # node-abi needs to the abi of the node here
    makeWrapper '${nodejs-14_x}/bin/node' "$out/bin/${pname}" \
      --set NODE_PATH $out/libexec/workadventureback/node_modules \
      --add-flags "$out/dist/server.js"
  '';
}