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