aboutsummaryrefslogtreecommitdiff
path: root/messages/default.nix
diff options
context:
space:
mode:
authorSandro Jäckel2020-12-31 21:46:39 +0100
committerSandro Jäckel2021-01-01 00:21:33 +0100
commit46954de8bc07649bd2337abdea109930c3e4f7ad (patch)
treee068da85c3615e723495c3cbbb887a06064326a0 /messages/default.nix
parent3a177c6831370811451ca39bad7609aa40a06f44 (diff)
Add front, fix back
Diffstat (limited to 'messages/default.nix')
-rw-r--r--messages/default.nix56
1 files changed, 43 insertions, 13 deletions
diff --git a/messages/default.nix b/messages/default.nix
index a1e03b9..4b1e734 100644
--- a/messages/default.nix
+++ b/messages/default.nix
@@ -1,6 +1,29 @@
-with (import <nixpkgs> {}); let
+with (import <nixpkgs> { }); let
+ node-protoc-precompiled = pkgs.fetchzip {
+ name = "node-protoc-precompiled";
+ url = "https://node-precompiled-binaries.grpc.io/grpc-tools/v1.10.0/linux-x64.tar.gz";
+ sha256 = "0dl1anpw3610q58mxf7r9dcp768krwvpa4053cjxn5r8b5xfbh4l";
+ };
-in yarn2nix-moretea.mkYarnPackage rec {
+ node-protoc-patched = pkgs.stdenv.mkDerivation {
+ name = "node-protoc";
+ buildInputs = [ pkgs.gcc-unwrapped.lib ];
+ nativeBuildInputs = [ pkgs.autoPatchelfHook ];
+ dontAutoPatchelf = true;
+ dontUnpack = true;
+ # protoc: symbol lookup error: /nix/store/...-node-protoc/bin/protoc: undefined symbol: , version
+ dontStrip = true;
+ installPhase = ''
+ install -D -m755 ${node-protoc-precompiled}/grpc_node_plugin $out/bin/grpc_node_plugin
+ install -D -m755 ${node-protoc-precompiled}/protoc $out/bin/protoc
+
+ autoPatchelf $out/bin/{grpc_node_plugin,protoc}
+ :
+ '';
+ };
+
+in
+yarn2nix-moretea.mkYarnPackage rec {
pname = "workadventuremessages";
version = "unstable";
@@ -11,22 +34,29 @@ in yarn2nix-moretea.mkYarnPackage rec {
sha256 = "1f1vi226kas7x9y8zw810q5vg1ikn4bb6ha9vnzvqk9y7jlc1n8q";
} + "/messages";
- # packageJSON = src + "/back/package.json";
- # yarnLock = src + "/back/yarn.lock";
# NOTE: this is optional and generated dynamically if omitted
yarnNix = ./yarn.nix;
- # pkgConfig = {
- # grpc = {
- # postInstall = ''
- # install -D -m755 ${node-grpc-patched}/bin/grpc_node.node src/node/extension_binary/node-v72-linux-x64-glibc/grpc_node.node
- # '';
- # };
- # };
+ pkgConfig = {
+ grpc-tools = {
+ postInstall = ''
+ install -D -m755 ${node-protoc-patched}/bin/grpc_node_plugin bin/grpc_node_plugin
+ install -D -m755 ${node-protoc-patched}/bin/protoc bin/protoc
+ '';
+ };
+ };
+
+ dontStrip = true;
buildPhase = ''
mkdir -p $out
- HOME=$TMPDIR yarn --offline proto
- find
+ HOME=$TMPDIR yarn --offline run proto
+ '';
+
+ distPhase = ":";
+
+ installPhase = ''
+ cp -r deps/workadventure-messages/generated $out/
+ cp -r node_modules $out/
'';
}