vscode: Fix relocation errors

LD_PRELOAD was inherited by spawned processes, and caused
issues with systems that have older system packages while
using fresh user packages.

Links out the wrapper script instead of electron binary to
expose CLI like on other systems

Breaks anything that relies on vscode not detaching
This commit is contained in:
Till Höppner
2017-03-31 20:34:35 +02:00
parent 739ecca4b5
commit c9d02b7c57
+2 -5
View File
@@ -55,7 +55,7 @@ in
'' else '' '' else ''
mkdir -p $out/lib/vscode $out/bin mkdir -p $out/lib/vscode $out/bin
cp -r ./* $out/lib/vscode cp -r ./* $out/lib/vscode
ln -s $out/lib/vscode/code $out/bin ln -s $out/lib/vscode/bin/code $out/bin
mkdir -p $out/share/applications mkdir -p $out/share/applications
cp $desktopItem/share/applications/* $out/share/applications cp $desktopItem/share/applications/* $out/share/applications
@@ -67,11 +67,8 @@ in
postFixup = lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") '' postFixup = lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") ''
patchelf \ patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${atomEnv.libPath}:$out/lib/vscode" \ --set-rpath "${atomEnv.libPath}:${stdenv.lib.makeLibraryPath [libXScrnSaver]}/libXss.so.1:$out/lib/vscode" \
$out/lib/vscode/code $out/lib/vscode/code
wrapProgram $out/bin/code \
--prefix LD_PRELOAD : ${stdenv.lib.makeLibraryPath [ libXScrnSaver ]}/libXss.so.1
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {