aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Bazanski2021-02-07 18:21:43 +0000
committerSerge Bazanski2021-02-07 18:21:43 +0000
commit90720751b638df1897a97942f50d3d30b6803c46 (patch)
tree1c553a6c7c9afac74be18768e2064aec0d69c3a6
parent059adccbe54c6a85d2366f0d0bb3956356bf64a3 (diff)
parent2d7380043979b6bc8e05cecda9d6277e1553777f (diff)
Merge branch 'informatic/deps-cleanup' into 'master'
Fix libc detection and reduce derivation size See merge request fediventure/workadventure-nix!3
-rw-r--r--back/default.nix6
-rw-r--r--pusher/default.nix8
2 files changed, 14 insertions, 0 deletions
diff --git a/back/default.nix b/back/default.nix
index 5f92960..a7e0858 100644
--- a/back/default.nix
+++ b/back/default.nix
@@ -6,6 +6,8 @@
, nodejs-14_x
, workadventure
, yarn2nix-moretea
+, lib
+, getconf
, ... }:
let
@@ -62,12 +64,16 @@ yarn2nix-moretea.mkYarnPackage rec {
ln -s ${workadventure.messages.outPath}/generated deps/${pname}/src/Messages/generated
HOME=$TMPDIR yarn --offline run tsc
cp -r deps/${pname}/dist $out/dist
+ rm -rf deps/${pname}/{src,node_modules}
'';
postInstall = ''
# node-abi needs to the abi of the node here
+ # getconf is required for detect-libc (used by node-pre-gyp) to properly
+ # detect current libc
makeWrapper '${nodejs-14_x}/bin/node' "$out/bin/${pname}" \
--set NODE_PATH $out/libexec/${pname}/node_modules \
+ --prefix PATH : ${lib.makeBinPath [ getconf ]} \
--add-flags "$out/dist/server.js"
'';
}
diff --git a/pusher/default.nix b/pusher/default.nix
index bdace68..1c41765 100644
--- a/pusher/default.nix
+++ b/pusher/default.nix
@@ -1,6 +1,8 @@
{ stdenv
, autoPatchelfHook
, makeWrapper
+, lib
+, getconf
, fetchzip
, fetchFromGitHub
@@ -60,17 +62,23 @@ yarn2nix-moretea.mkYarnPackage rec {
dontStrip = true;
+ # workadventureback below is a package name extracted from package.json,
+ # intended until upstream fixes that up.
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
+ rm -rf deps/workadventureback/{src,node_modules}
'';
postInstall = ''
# node-abi needs to the abi of the node here
+ # getconf is required for detect-libc (used by node-pre-gyp) to properly
+ # detect current libc
makeWrapper '${nodejs-14_x}/bin/node' "$out/bin/${pname}" \
--set NODE_PATH $out/libexec/workadventureback/node_modules \
+ --prefix PATH : ${lib.makeBinPath [ getconf ]} \
--add-flags "$out/dist/server.js"
'';
}