@@ -1,9 +1,9 @@
11{ stdenv, lib, fetchurl, unzip, atomEnv, makeDesktopItem,
2− gtk2, wrapGAppsHook, libXScrnSaver, libxkbfile, libsecret }:
2+ gtk2, wrapGAppsHook, libXScrnSaver, libxkbfile, libsecret,
3+ isInsiders ? false }:
34
45let
5− version = "1.29.1";
6− channel = "stable";
6+ executableName = "code" + lib.optionalString isInsiders "-insiders";
77
88 plat = {
99 "i686-linux" = "linux-ia32";
@@ -31,19 +31,24 @@ let
3131in
3232 stdenv.mkDerivation rec {
3333 name = "vscode-${version}";
34+ version = "1.29.1";
3435
3536 src = fetchurl {
3637 name = "VSCode_${version}_${plat}.${archive_fmt}";
37− url = "https://vscode-update.azurewebsites.net/${version}/${plat}/${channel}";
38+ url = "https://vscode-update.azurewebsites.net/${version}/${plat}/stable";
3839 inherit sha256;
3940 };
4041
42+ passthru = {
43+ inherit executableName;
44+ };
45+
4146 desktopItem = makeDesktopItem {
42− name = "code";
43− exec = "code";
44− icon = "code";
47+ name = executableName;
48+ exec = executableName;
49+ icon = "@out@/share/pixmaps/code.png";
4550 comment = "Code editor redefined and optimized for building and debugging modern web and cloud applications";
46− desktopName = "Visual Studio Code";
51+ desktopName = "Visual Studio Code" + lib.optionalString isInsiders " Insiders";
4752 genericName = "Text Editor";
4853 categories = "GNOME;GTK;Utility;TextEditor;Development;";
4954 };
@@ -56,17 +61,18 @@ in
5661 if stdenv.hostPlatform.system == "x86_64-darwin" then ''
5762 mkdir -p $out/lib/vscode $out/bin
5863 cp -r ./* $out/lib/vscode
59− ln -s $out/lib/vscode/Contents/Resources/app/bin/code $out/bin
64+ ln -s $out/lib/vscode/Contents/Resources/app/bin/${executableName} $out/bin
6065 '' else ''
6166 mkdir -p $out/lib/vscode $out/bin
6267 cp -r ./* $out/lib/vscode
6368
64− substituteInPlace $out/lib/vscode/bin/code --replace '"$CLI" "$@"' '"$CLI" "--skip-getting-started" "$@"'
69+ substituteInPlace $out/lib/vscode/bin/${executableName} --replace '"$CLI" "$@"' '"$CLI" "--skip-getting-started" "$@"'
6570
66− ln -s $out/lib/vscode/bin/code $out/bin
71+ ln -s $out/lib/vscode/bin/${executableName} $out/bin
6772
6873 mkdir -p $out/share/applications
69− cp $desktopItem/share/applications/* $out/share/applications
74+ substitute $desktopItem/share/applications/${executableName}.desktop $out/share/applications/${executableName}.desktop \
75+ --subst-var out
7076
7177 mkdir -p $out/share/pixmaps
7278 cp $out/lib/vscode/resources/app/resources/linux/code.png $out/share/pixmaps/code.png
@@ -76,7 +82,7 @@ in
7682 patchelf \
7783 --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
7884 --set-rpath "${rpath}" \
79− $out/lib/vscode/code
85+ $out/lib/vscode/${executableName}
8086
8187 patchelf \
8288 --set-rpath "${rpath}" \