vscode,vscode-extensions: fix insiders build
This commit is contained in:
parent
5c26dc3d84
commit
d41e868e02
|
@ -1,9 +1,9 @@
|
|||
{ stdenv, lib, fetchurl, unzip, atomEnv, makeDesktopItem,
|
||||
gtk2, wrapGAppsHook, libXScrnSaver, libxkbfile, libsecret }:
|
||||
gtk2, wrapGAppsHook, libXScrnSaver, libxkbfile, libsecret,
|
||||
isInsiders ? false }:
|
||||
|
||||
let
|
||||
version = "1.29.1";
|
||||
channel = "stable";
|
||||
executableName = "code" + lib.optionalString isInsiders "-insiders";
|
||||
|
||||
plat = {
|
||||
"i686-linux" = "linux-ia32";
|
||||
|
@ -31,19 +31,24 @@ let
|
|||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "vscode-${version}";
|
||||
version = "1.29.1";
|
||||
|
||||
src = fetchurl {
|
||||
name = "VSCode_${version}_${plat}.${archive_fmt}";
|
||||
url = "https://vscode-update.azurewebsites.net/${version}/${plat}/${channel}";
|
||||
url = "https://vscode-update.azurewebsites.net/${version}/${plat}/stable";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
passthru = {
|
||||
inherit executableName;
|
||||
};
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = "code";
|
||||
exec = "code";
|
||||
icon = "code";
|
||||
name = executableName;
|
||||
exec = executableName;
|
||||
icon = "@out@/share/pixmaps/code.png";
|
||||
comment = "Code editor redefined and optimized for building and debugging modern web and cloud applications";
|
||||
desktopName = "Visual Studio Code";
|
||||
desktopName = "Visual Studio Code" + lib.optionalString isInsiders " Insiders";
|
||||
genericName = "Text Editor";
|
||||
categories = "GNOME;GTK;Utility;TextEditor;Development;";
|
||||
};
|
||||
|
@ -56,17 +61,18 @@ in
|
|||
if stdenv.hostPlatform.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/code $out/bin
|
||||
ln -s $out/lib/vscode/Contents/Resources/app/bin/${executableName} $out/bin
|
||||
'' else ''
|
||||
mkdir -p $out/lib/vscode $out/bin
|
||||
cp -r ./* $out/lib/vscode
|
||||
|
||||
substituteInPlace $out/lib/vscode/bin/code --replace '"$CLI" "$@"' '"$CLI" "--skip-getting-started" "$@"'
|
||||
substituteInPlace $out/lib/vscode/bin/${executableName} --replace '"$CLI" "$@"' '"$CLI" "--skip-getting-started" "$@"'
|
||||
|
||||
ln -s $out/lib/vscode/bin/code $out/bin
|
||||
ln -s $out/lib/vscode/bin/${executableName} $out/bin
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
cp $desktopItem/share/applications/* $out/share/applications
|
||||
substitute $desktopItem/share/applications/${executableName}.desktop $out/share/applications/${executableName}.desktop \
|
||||
--subst-var out
|
||||
|
||||
mkdir -p $out/share/pixmaps
|
||||
cp $out/lib/vscode/resources/app/resources/linux/code.png $out/share/pixmaps/code.png
|
||||
|
@ -76,7 +82,7 @@ in
|
|||
patchelf \
|
||||
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath "${rpath}" \
|
||||
$out/lib/vscode/code
|
||||
$out/lib/vscode/${executableName}
|
||||
|
||||
patchelf \
|
||||
--set-rpath "${rpath}" \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, lib, runCommand, buildEnv, vscode, which, writeScript
|
||||
{ stdenv, lib, runCommand, buildEnv, vscode, makeWrapper
|
||||
, vscodeExtensions ? [] }:
|
||||
|
||||
/*
|
||||
|
@ -43,6 +43,7 @@
|
|||
|
||||
let
|
||||
|
||||
inherit (vscode) executableName;
|
||||
wrappedPkgVersion = lib.getVersion vscode;
|
||||
wrappedPkgName = lib.removeSuffix "-${wrappedPkgVersion}" vscode.name;
|
||||
|
||||
|
@ -51,22 +52,12 @@ let
|
|||
paths = vscodeExtensions;
|
||||
};
|
||||
|
||||
wrappedExeName = "code";
|
||||
exeName = wrappedExeName;
|
||||
|
||||
wrapperExeFile = writeScript "${exeName}" ''
|
||||
#!${stdenv.shell}
|
||||
exec ${vscode}/bin/${wrappedExeName} \
|
||||
--extensions-dir "${combinedExtensionsDrv}/share/${wrappedPkgName}/extensions" \
|
||||
"$@"
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
# When no extensions are requested, we simply redirect to the original
|
||||
# non-wrapped vscode executable.
|
||||
runCommand "${wrappedPkgName}-with-extensions-${wrappedPkgVersion}" {
|
||||
buildInputs = [ vscode which ];
|
||||
buildInputs = [ vscode makeWrapper ];
|
||||
dontPatchELF = true;
|
||||
dontStrip = true;
|
||||
meta = vscode.meta;
|
||||
|
@ -75,13 +66,9 @@ runCommand "${wrappedPkgName}-with-extensions-${wrappedPkgVersion}" {
|
|||
mkdir -p "$out/share/applications"
|
||||
mkdir -p "$out/share/pixmaps"
|
||||
|
||||
ln -sT "${vscode}/share/applications/code.desktop" "$out/share/applications/code.desktop"
|
||||
ln -sT "${vscode}/share/pixmaps/code.png" "$out/share/pixmaps/code.png"
|
||||
${if [] == vscodeExtensions
|
||||
then ''
|
||||
ln -sT "${vscode}/bin/${wrappedExeName}" "$out/bin/${exeName}"
|
||||
''
|
||||
else ''
|
||||
ln -sT "${wrapperExeFile}" "$out/bin/${exeName}"
|
||||
''}
|
||||
ln -sT "${vscode}/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop"
|
||||
makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" \
|
||||
--add-flags \
|
||||
"--extensions-dir ${combinedExtensionsDrv}/share/${wrappedPkgName}/extensions"
|
||||
''
|
||||
|
|
Loading…
Reference in New Issue