Skip to content

Commit

Permalink
vscode: minor cleanup, produce one wrapper on linux
Browse files Browse the repository at this point in the history
I removed the hack for libsecret, introduced in[0] and
I didn't encounter any problems at runtime.

[0]: #29127
  • Loading branch information
worldofpeace committed Feb 10, 2019
1 parent 919a5f6 commit d9b1486
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions pkgs/applications/editors/vscode/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ let
longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders";
shortName = "Code" + lib.optionalString isInsiders " - Insiders";

inherit (stdenv.hostPlatform) system;

plat = {
"i686-linux" = "linux-ia32";
"x86_64-linux" = "linux-x64";
"x86_64-darwin" = "darwin";
}.${stdenv.hostPlatform.system};
}.${system};

sha256 = {
"i686-linux" = "1g73fay6fxlqhalkqq5m6rjbp68k9npk0rrxrkhdj8mw0cz74dpm";
"x86_64-linux" = "0mil8n5i2ajdyrgq862wq59ajy2122rvvn7m7mxq4ab92sk26rix";
"x86_64-darwin" = "07r52scs1sgafzxqal39r8vf9p9qqvwwx8f6z09gqcf6clr6k48q";
}.${stdenv.hostPlatform.system};

archive_fmt = if stdenv.hostPlatform.system == "x86_64-darwin" then "zip" else "tar.gz";
archive_fmt = if system == "x86_64-darwin" then "zip" else "tar.gz";
in
stdenv.mkDerivation rec {
name = "vscode-${version}";
Expand Down Expand Up @@ -82,8 +84,11 @@ in

nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook;

dontBuild = true;
dontConfigure = true;

installPhase =
if stdenv.hostPlatform.system == "x86_64-darwin" then ''
if system == "x86_64-darwin" then ''
mkdir -p $out/lib/vscode $out/bin
cp -r ./* $out/lib/vscode
ln -s $out/lib/vscode/Contents/Resources/app/bin/${executableName} $out/bin
Expand All @@ -105,11 +110,8 @@ in
cp $out/lib/vscode/resources/app/resources/linux/code.png $out/share/pixmaps/code.png
'';

postFixup = lib.optionalString (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux") ''
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
preFixup = lib.optionalString (system == "i686-linux" || system == "x86_64-linux") ''
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ systemd fontconfig ]})
'';

meta = with stdenv.lib; {
Expand Down

0 comments on commit d9b1486

Please sign in to comment.