about summary refs log tree commit diff
path: root/pkgs/applications/editors/vscode
diff options
context:
space:
mode:
authorEdmund Wu <fangkazuto@gmail.com>2018-12-16 22:09:21 -0500
committerworldofpeace <worldofpeace@users.noreply.github.com>2019-02-10 19:52:42 +0000
commit919a5f696357f92aa5acb5b57c09dfb20d37852e (patch)
tree96547703f78ccb04fbbe6f5af4eced8eaca170f6 /pkgs/applications/editors/vscode
parent9905c44eca081d367411f19ae657fa6b5afd2686 (diff)
downloadnixlib-919a5f696357f92aa5acb5b57c09dfb20d37852e.tar
nixlib-919a5f696357f92aa5acb5b57c09dfb20d37852e.tar.gz
nixlib-919a5f696357f92aa5acb5b57c09dfb20d37852e.tar.bz2
nixlib-919a5f696357f92aa5acb5b57c09dfb20d37852e.tar.lz
nixlib-919a5f696357f92aa5acb5b57c09dfb20d37852e.tar.xz
nixlib-919a5f696357f92aa5acb5b57c09dfb20d37852e.tar.zst
nixlib-919a5f696357f92aa5acb5b57c09dfb20d37852e.zip
vscode: fix rpath for native modules
Diffstat (limited to 'pkgs/applications/editors/vscode')
-rw-r--r--pkgs/applications/editors/vscode/default.nix42
1 files changed, 13 insertions, 29 deletions
diff --git a/pkgs/applications/editors/vscode/default.nix b/pkgs/applications/editors/vscode/default.nix
index 08c8561abeda..f64a22e642d2 100644
--- a/pkgs/applications/editors/vscode/default.nix
+++ b/pkgs/applications/editors/vscode/default.nix
@@ -1,6 +1,8 @@
-{ stdenv, lib, fetchurl, unzip, atomEnv, makeDesktopItem,
-  gtk2, wrapGAppsHook, libXScrnSaver, libxkbfile, libsecret,
-  isInsiders ? false }:
+{ stdenv, lib, fetchurl, makeDesktopItem
+, unzip, libsecret, libXScrnSaver, wrapGAppsHook
+, gtk2, atomEnv, at-spi2-atk, autoPatchelfHook
+, systemd, fontconfig
+, isInsiders ? false }:
 
 let
   executableName = "code" + lib.optionalString isInsiders "-insiders";
@@ -20,16 +22,6 @@ let
   }.${stdenv.hostPlatform.system};
 
   archive_fmt = if stdenv.hostPlatform.system == "x86_64-darwin" then "zip" else "tar.gz";
-
-  rpath = lib.concatStringsSep ":" [
-    atomEnv.libPath
-    "${lib.makeLibraryPath [gtk2]}"
-    "${lib.makeLibraryPath [libsecret]}/libsecret-1.so.0"
-    "${lib.makeLibraryPath [libXScrnSaver]}/libXss.so.1"
-    "${lib.makeLibraryPath [libxkbfile]}/libxkbfile.so.1"
-    "$out/lib/vscode"
-  ];
-
 in
   stdenv.mkDerivation rec {
     name = "vscode-${version}";
@@ -83,9 +75,12 @@ in
       '';
     };
 
-    buildInputs = if stdenv.hostPlatform.system == "x86_64-darwin"
-      then [ unzip libXScrnSaver libsecret ]
-      else [ wrapGAppsHook libXScrnSaver libxkbfile libsecret ];
+    buildInputs = (if stdenv.isDarwin
+      then [ unzip ]
+      else [ gtk2 at-spi2-atk wrapGAppsHook ] ++ atomEnv.packages)
+        ++ [ libsecret libXScrnSaver ];
+
+    nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook;
 
     installPhase =
       if stdenv.hostPlatform.system == "x86_64-darwin" then ''
@@ -111,19 +106,8 @@ in
       '';
 
     postFixup = lib.optionalString (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux") ''
-      patchelf \
-        --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-        --set-rpath "${rpath}" \
-        $out/lib/vscode/${executableName}
-
-      patchelf \
-        --set-rpath "${rpath}" \
-        $out/lib/vscode/resources/app/node_modules.asar.unpacked/keytar/build/Release/keytar.node
-
-      patchelf \
-        --set-rpath "${rpath}" \
-        "$out/lib/vscode/resources/app/node_modules.asar.unpacked/native-keymap/build/Release/\
-      keymapping.node"
+      wrapProgram $out/lib/vscode/${executableName} \
+        --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ systemd fontconfig ]}
 
       ln -s ${lib.makeLibraryPath [libsecret]}/libsecret-1.so.0 $out/lib/vscode/libsecret-1.so.0
     '';