aboutsummaryrefslogtreecommitdiff
path: root/uploader/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'uploader/default.nix')
-rw-r--r--uploader/default.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/uploader/default.nix b/uploader/default.nix
new file mode 100644
index 0000000..fa42f12
--- /dev/null
+++ b/uploader/default.nix
@@ -0,0 +1,42 @@
+{ stdenv
+, fetchFromGitHub
+, makeWrapper
+, mkYarnPackage
+, nodejs-14_x
+, workadventure
+, yarn2nix-moretea
+, ... }:
+
+yarn2nix-moretea.mkYarnPackage rec {
+ pname = "workadventureuploader";
+ version = "unstable";
+
+ src = fetchFromGitHub
+ {
+ owner = "thecodingmachine";
+ repo = "workadventure";
+ rev = "6e9c71598004dc9cbab9418efb3c0ac892da7ca2";
+ sha256 = "0rvra0dy631al4aylacyqldkyd6biawz2shsikgcy30nv5lzc78c";
+ } + "/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"
+ '';
+}