about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/vscode
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/vscode')
-rw-r--r--nixpkgs/pkgs/applications/editors/vscode/generic.nix190
-rwxr-xr-xnixpkgs/pkgs/applications/editors/vscode/update-vscode.sh40
-rwxr-xr-xnixpkgs/pkgs/applications/editors/vscode/update-vscodium.sh36
-rw-r--r--nixpkgs/pkgs/applications/editors/vscode/vscode.nix63
-rw-r--r--nixpkgs/pkgs/applications/editors/vscode/vscodium.nix68
-rw-r--r--nixpkgs/pkgs/applications/editors/vscode/with-extensions.nix86
6 files changed, 483 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/editors/vscode/generic.nix b/nixpkgs/pkgs/applications/editors/vscode/generic.nix
new file mode 100644
index 000000000000..f2c262ece95d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/vscode/generic.nix
@@ -0,0 +1,190 @@
+{ stdenv, lib, makeDesktopItem
+, unzip, libsecret, libXScrnSaver, libxshmfence, wrapGAppsHook
+, gtk2, atomEnv, at-spi2-atk, autoPatchelfHook
+, systemd, fontconfig, libdbusmenu, glib, buildFHSUserEnvBubblewrap
+, writeShellScriptBin
+
+# Populate passthru.tests
+, tests
+
+# needed to fix "Save as Root"
+, nodePackages, bash
+
+# Attributes inherit from specific versions
+, version, src, meta, sourceRoot
+, executableName, longName, shortName, pname, updateScript
+# sourceExecutableName is the name of the binary in the source archive, over
+# which we have no control
+, sourceExecutableName ? executableName
+}:
+
+let
+  inherit (stdenv.hostPlatform) system;
+  unwrapped = stdenv.mkDerivation {
+
+    inherit pname version src sourceRoot;
+
+    passthru = {
+      inherit executableName longName tests updateScript;
+      fhs = fhs {};
+      fhsWithPackages = f: fhs { additionalPkgs = f; };
+    };
+
+    desktopItem = makeDesktopItem {
+      name = executableName;
+      desktopName = longName;
+      comment = "Code Editing. Redefined.";
+      genericName = "Text Editor";
+      exec = "${executableName} %F";
+      icon = "code";
+      startupNotify = "true";
+      categories = "Utility;TextEditor;Development;IDE;";
+      mimeType = "text/plain;inode/directory;";
+      extraEntries = ''
+        StartupWMClass=${shortName}
+        Actions=new-empty-window;
+        Keywords=vscode;
+
+        [Desktop Action new-empty-window]
+        Name=New Empty Window
+        Exec=${executableName} --new-window %F
+        Icon=code
+      '';
+    };
+
+    urlHandlerDesktopItem = makeDesktopItem {
+      name = executableName + "-url-handler";
+      desktopName = longName + " - URL Handler";
+      comment = "Code Editing. Redefined.";
+      genericName = "Text Editor";
+      exec = executableName + " --open-url %U";
+      icon = "code";
+      startupNotify = "true";
+      categories = "Utility;TextEditor;Development;IDE;";
+      mimeType = "x-scheme-handler/vscode;";
+      extraEntries = ''
+        NoDisplay=true
+        Keywords=vscode;
+      '';
+    };
+
+    buildInputs = [ libsecret libXScrnSaver libxshmfence ]
+      ++ lib.optionals (!stdenv.isDarwin) ([ gtk2 at-spi2-atk ] ++ atomEnv.packages);
+
+    runtimeDependencies = lib.optional (stdenv.isLinux) [ (lib.getLib systemd) fontconfig.lib libdbusmenu ];
+
+    nativeBuildInputs = [unzip] ++ lib.optionals (!stdenv.isDarwin) [ autoPatchelfHook wrapGAppsHook ];
+
+    dontBuild = true;
+    dontConfigure = true;
+
+    installPhase = ''
+      runHook preInstall
+    '' + (if stdenv.isDarwin then ''
+      mkdir -p "$out/Applications/${longName}.app" "$out/bin"
+      cp -r ./* "$out/Applications/${longName}.app"
+      ln -s "$out/Applications/${longName}.app/Contents/Resources/app/bin/${sourceExecutableName}" "$out/bin/${executableName}"
+    '' else ''
+      mkdir -p "$out/lib/vscode" "$out/bin"
+      cp -r ./* "$out/lib/vscode"
+
+      ln -s "$out/lib/vscode/bin/${sourceExecutableName}" "$out/bin/${executableName}"
+
+      mkdir -p "$out/share/applications"
+      ln -s "$desktopItem/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop"
+      ln -s "$urlHandlerDesktopItem/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop"
+
+      mkdir -p "$out/share/pixmaps"
+      cp "$out/lib/vscode/resources/app/resources/linux/code.png" "$out/share/pixmaps/code.png"
+
+      # Override the previously determined VSCODE_PATH with the one we know to be correct
+      sed -i "/ELECTRON=/iVSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}"
+      grep -q "VSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}" # check if sed succeeded
+    '') + ''
+      runHook postInstall
+    '';
+
+    preFixup = ''
+      gappsWrapperArgs+=(
+        # Add gio to PATH so that moving files to the trash works when not using a desktop environment
+        --prefix PATH : ${glib.bin}/bin
+      )
+    '';
+
+    # See https://github.com/NixOS/nixpkgs/issues/49643#issuecomment-873853897
+    # linux only because of https://github.com/NixOS/nixpkgs/issues/138729
+    postPatch = lib.optionalString stdenv.isLinux ''
+      # this is a fix for "save as root" functionality
+      packed="resources/app/node_modules.asar"
+      unpacked="resources/app/node_modules"
+      ${nodePackages.asar}/bin/asar extract "$packed" "$unpacked"
+      substituteInPlace $unpacked/@vscode/sudo-prompt/index.js \
+        --replace "/usr/bin/pkexec" "/run/wrappers/bin/pkexec" \
+        --replace "/bin/bash" "${bash}/bin/bash"
+      rm -rf "$packed"
+
+      # this fixes bundled ripgrep
+      chmod +x resources/app/node_modules/vscode-ripgrep/bin/rg
+    '';
+
+    inherit meta;
+  };
+
+  # Vscode and variants allow for users to download and use extensions
+  # which often include the usage of pre-built binaries.
+  # This has been an on-going painpoint for many users, as
+  # a full extension update cycle has to be done through nixpkgs
+  # in order to create or update extensions.
+  # See: #83288 #91179 #73810 #41189
+  #
+  # buildFHSUserEnv allows for users to use the existing vscode
+  # extension tooling without significant pain.
+  fhs = { additionalPkgs ? pkgs: [] }: buildFHSUserEnvBubblewrap {
+    # also determines the name of the wrapped command
+    name = executableName;
+
+    # additional libraries which are commonly needed for extensions
+    targetPkgs = pkgs: (with pkgs; [
+      # ld-linux-x86-64-linux.so.2 and others
+      glibc
+
+      # dotnet
+      curl
+      icu
+      libunwind
+      libuuid
+      openssl
+      zlib
+
+      # mono
+      krb5
+    ]) ++ additionalPkgs pkgs;
+
+    # restore desktop item icons
+    extraInstallCommands = ''
+      mkdir -p "$out/share/applications"
+      for item in ${unwrapped}/share/applications/*.desktop; do
+        ln -s "$item" "$out/share/applications/"
+      done
+    '';
+
+    runScript = "${unwrapped}/bin/${executableName}";
+
+    # vscode likes to kill the parent so that the
+    # gui application isn't attached to the terminal session
+    dieWithParent = false;
+
+    passthru = {
+      inherit executableName;
+      inherit (unwrapped) pname version; # for home-manager module
+    };
+
+    meta = meta // {
+      description = ''
+        Wrapped variant of ${pname} which launches in a FHS compatible envrionment.
+        Should allow for easy usage of extensions without nix-specific modifications.
+      '';
+    };
+  };
+in
+  unwrapped
diff --git a/nixpkgs/pkgs/applications/editors/vscode/update-vscode.sh b/nixpkgs/pkgs/applications/editors/vscode/update-vscode.sh
new file mode 100755
index 000000000000..709fbe1c7517
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/vscode/update-vscode.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl jq gnused
+
+# Update script for the vscode versions and hashes.
+# Usually doesn't need to be called by hand,
+# but is called by a bot: https://github.com/samuela/nixpkgs-upkeep/actions
+# Call it by hand if the bot fails to automatically update the versions.
+
+set -eou pipefail
+
+ROOT="$(dirname "$(readlink -f "$0")")"
+if [ ! -f "$ROOT/vscode.nix" ]; then
+  echo "ERROR: cannot find vscode.nix in $ROOT"
+  exit 1
+fi
+
+# VSCode
+
+VSCODE_VER=$(curl --fail --silent https://api.github.com/repos/Microsoft/vscode/releases/latest | jq --raw-output .tag_name)
+sed -i "s/version = \".*\"/version = \"${VSCODE_VER}\"/" "$ROOT/vscode.nix"
+
+VSCODE_X64_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-x64/stable"
+VSCODE_X64_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_X64_LINUX_URL})
+sed -i "s/x86_64-linux = \".\{52\}\"/x86_64-linux = \"${VSCODE_X64_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
+
+VSCODE_X64_DARWIN_URL="https://update.code.visualstudio.com/${VSCODE_VER}/darwin/stable"
+VSCODE_X64_DARWIN_SHA256=$(nix-prefetch-url ${VSCODE_X64_DARWIN_URL})
+sed -i "s/x86_64-darwin = \".\{52\}\"/x86_64-darwin = \"${VSCODE_X64_DARWIN_SHA256}\"/" "$ROOT/vscode.nix"
+
+VSCODE_AARCH64_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-arm64/stable"
+VSCODE_AARCH64_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_AARCH64_LINUX_URL})
+sed -i "s/aarch64-linux = \".\{52\}\"/aarch64-linux = \"${VSCODE_AARCH64_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
+
+VSCODE_AARCH64_DARWIN_URL="https://update.code.visualstudio.com/${VSCODE_VER}/darwin-arm64/stable"
+VSCODE_AARCH64_DARWIN_SHA256=$(nix-prefetch-url ${VSCODE_AARCH64_DARWIN_URL})
+sed -i "s/aarch64-darwin = \".\{52\}\"/aarch64-darwin = \"${VSCODE_AARCH64_DARWIN_SHA256}\"/" "$ROOT/vscode.nix"
+
+VSCODE_ARMV7L_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-armhf/stable"
+VSCODE_ARMV7L_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_ARMV7L_LINUX_URL})
+sed -i "s/armv7l-linux = \".\{52\}\"/armv7l-linux = \"${VSCODE_ARMV7L_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
diff --git a/nixpkgs/pkgs/applications/editors/vscode/update-vscodium.sh b/nixpkgs/pkgs/applications/editors/vscode/update-vscodium.sh
new file mode 100755
index 000000000000..79c6b497ecc6
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/vscode/update-vscodium.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl gnugrep gnused gawk
+
+# Update script for the vscode versions and hashes.
+# Usually doesn't need to be called by hand,
+# but is called by a bot: https://github.com/samuela/nixpkgs-upkeep/actions
+# Call it by hand if the bot fails to automatically update the versions.
+
+set -eou pipefail
+
+ROOT="$(dirname "$(readlink -f "$0")")"
+if [ ! -f "$ROOT/vscodium.nix" ]; then
+  echo "ERROR: cannot find vscodium.nix in $ROOT"
+  exit 1
+fi
+
+# VSCodium
+
+VSCODIUM_VER=$(curl -Ls -w %{url_effective} -o /dev/null https://github.com/VSCodium/vscodium/releases/latest | awk -F'/' '{print $NF}')
+sed -i "s/version = \".*\"/version = \"${VSCODIUM_VER}\"/" "$ROOT/vscodium.nix"
+
+VSCODIUM_LINUX_X64_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-linux-x64-${VSCODIUM_VER}.tar.gz"
+VSCODIUM_LINUX_X64_SHA256=$(nix-prefetch-url ${VSCODIUM_LINUX_X64_URL})
+sed -i "s/x86_64-linux = \".\{52\}\"/x86_64-linux = \"${VSCODIUM_LINUX_X64_SHA256}\"/" "$ROOT/vscodium.nix"
+
+VSCODIUM_DARWIN_X64_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-darwin-x64-${VSCODIUM_VER}.zip"
+VSCODIUM_DARWIN_X64_SHA256=$(nix-prefetch-url ${VSCODIUM_DARWIN_X64_URL})
+sed -i "s/x86_64-darwin = \".\{52\}\"/x86_64-darwin = \"${VSCODIUM_DARWIN_X64_SHA256}\"/" "$ROOT/vscodium.nix"
+
+VSCODIUM_LINUX_AARCH64_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-linux-arm64-${VSCODIUM_VER}.tar.gz"
+VSCODIUM_LINUX_AARCH64_SHA256=$(nix-prefetch-url ${VSCODIUM_LINUX_AARCH64_URL})
+sed -i "s/aarch64-linux = \".\{52\}\"/aarch64-linux = \"${VSCODIUM_LINUX_AARCH64_SHA256}\"/" "$ROOT/vscodium.nix"
+
+VSCODIUM_LINUX_ARMV7L_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-linux-armhf-${VSCODIUM_VER}.tar.gz"
+VSCODIUM_LINUX_ARMV7L_SHA256=$(nix-prefetch-url ${VSCODIUM_LINUX_ARMV7L_URL})
+sed -i "s/armv7l-linux = \".\{52\}\"/armv7l-linux = \"${VSCODIUM_LINUX_ARMV7L_SHA256}\"/" "$ROOT/vscodium.nix"
diff --git a/nixpkgs/pkgs/applications/editors/vscode/vscode.nix b/nixpkgs/pkgs/applications/editors/vscode/vscode.nix
new file mode 100644
index 000000000000..8990ef75a850
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/vscode/vscode.nix
@@ -0,0 +1,63 @@
+{ stdenv, lib, callPackage, fetchurl, isInsiders ? false }:
+
+let
+  inherit (stdenv.hostPlatform) system;
+
+  plat = {
+    x86_64-linux = "linux-x64";
+    x86_64-darwin = "darwin";
+    aarch64-linux = "linux-arm64";
+    aarch64-darwin = "darwin-arm64";
+    armv7l-linux = "linux-armhf";
+  }.${system};
+
+  archive_fmt = if stdenv.isDarwin then "zip" else "tar.gz";
+
+  sha256 = {
+    x86_64-linux = "1bglf1a8b5whv9pk811fdnx0mvfcfasjxbik73p67msp4yy68lm4";
+    x86_64-darwin = "0cv6i2i69xf6hn0vrfl3gk3ky7r5yvp4k7zx2k695gzck5s9bx8y";
+    aarch64-linux = "1jggspj5q4vfgs4xdvx5p8qsfm98wf17jmxqzs68lmlhmhadyh22";
+    aarch64-darwin = "0c1nz7a54xq20a2a4fqcmlhry6gqwz5f1ys7dx0x5whaxbybh8my";
+    armv7l-linux = "0p2rdxbqpzk79ra7br7wfs8kr0hnh3l022mqb7y16gc426xjlfn4";
+  }.${system};
+in
+  callPackage ./generic.nix rec {
+    # Please backport all compatible updates to the stable release.
+    # This is important for the extension ecosystem.
+    version = "1.63.2";
+    pname = "vscode";
+
+    executableName = "code" + lib.optionalString isInsiders "-insiders";
+    longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders";
+    shortName = "Code" + lib.optionalString isInsiders " - Insiders";
+
+    src = fetchurl {
+      name = "VSCode_${version}_${plat}.${archive_fmt}";
+      url = "https://update.code.visualstudio.com/${version}/${plat}/stable";
+      inherit sha256;
+    };
+
+    sourceRoot = "";
+
+    updateScript = ./update-vscode.sh;
+
+    meta = with lib; {
+      description = ''
+        Open source source code editor developed by Microsoft for Windows,
+        Linux and macOS
+      '';
+      mainProgram = "code";
+      longDescription = ''
+        Open source source code editor developed by Microsoft for Windows,
+        Linux and macOS. It includes support for debugging, embedded Git
+        control, syntax highlighting, intelligent code completion, snippets,
+        and code refactoring. It is also customizable, so users can change the
+        editor's theme, keyboard shortcuts, and preferences
+      '';
+      homepage = "https://code.visualstudio.com/";
+      downloadPage = "https://code.visualstudio.com/Updates";
+      license = licenses.unfree;
+      maintainers = with maintainers; [ eadwu synthetica maxeaubrey bobby285271 ];
+      platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" "armv7l-linux" ];
+    };
+  }
diff --git a/nixpkgs/pkgs/applications/editors/vscode/vscodium.nix b/nixpkgs/pkgs/applications/editors/vscode/vscodium.nix
new file mode 100644
index 000000000000..0ca39a728424
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/vscode/vscodium.nix
@@ -0,0 +1,68 @@
+{ lib, stdenv, callPackage, fetchurl, nixosTests }:
+
+let
+  inherit (stdenv.hostPlatform) system;
+
+  plat = {
+    x86_64-linux = "linux-x64";
+    x86_64-darwin = "darwin-x64";
+    aarch64-linux = "linux-arm64";
+    armv7l-linux = "linux-armhf";
+  }.${system};
+
+  archive_fmt = if system == "x86_64-darwin" then "zip" else "tar.gz";
+
+  sha256 = {
+    x86_64-linux = "0pczrbifjgm905371i8c6bk90ka291cmny6hr1nzfix7bn5psjx0";
+    x86_64-darwin = "12g2jlrhng3i56a4v9jf7nrj045jivnfdx4dhka1fiv60nn4gc46";
+    aarch64-linux = "1bhhz4yvmk3zqljy3b77hlsxbwm2l675pslhwr44p6fb4hmn8fai";
+    armv7l-linux = "15nbskq92b85zdyg7pgagi9mqhnbyisfkipqb3brc2rvmyxpzclb";
+  }.${system};
+
+  sourceRoot = {
+    x86_64-linux = ".";
+    x86_64-darwin = "";
+    aarch64-linux = ".";
+    armv7l-linux = ".";
+  }.${system};
+in
+  callPackage ./generic.nix rec {
+    inherit sourceRoot;
+
+    # Please backport all compatible updates to the stable release.
+    # This is important for the extension ecosystem.
+    version = "1.63.2";
+    pname = "vscodium";
+
+    executableName = "codium";
+    longName = "VSCodium";
+    shortName = "vscodium";
+
+    src = fetchurl {
+      url = "https://github.com/VSCodium/vscodium/releases/download/${version}/VSCodium-${plat}-${version}.${archive_fmt}";
+      inherit sha256;
+    };
+
+    tests = nixosTests.vscodium;
+
+    updateScript = ./update-vscodium.sh;
+
+    meta = with lib; {
+      description = ''
+        Open source source code editor developed by Microsoft for Windows,
+        Linux and macOS (VS Code without MS branding/telemetry/licensing)
+      '';
+      longDescription = ''
+        Open source source code editor developed by Microsoft for Windows,
+        Linux and macOS. It includes support for debugging, embedded Git
+        control, syntax highlighting, intelligent code completion, snippets,
+        and code refactoring. It is also customizable, so users can change the
+        editor's theme, keyboard shortcuts, and preferences
+      '';
+      homepage = "https://github.com/VSCodium/vscodium";
+      downloadPage = "https://github.com/VSCodium/vscodium/releases";
+      license = licenses.mit;
+      maintainers = with maintainers; [ synthetica turion bobby285271 ];
+      platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "armv7l-linux" ];
+    };
+  }
diff --git a/nixpkgs/pkgs/applications/editors/vscode/with-extensions.nix b/nixpkgs/pkgs/applications/editors/vscode/with-extensions.nix
new file mode 100644
index 000000000000..1c9c4be45631
--- /dev/null
+++ b/nixpkgs/pkgs/applications/editors/vscode/with-extensions.nix
@@ -0,0 +1,86 @@
+{ lib, stdenv, runCommand, buildEnv, vscode, makeWrapper
+, vscodeExtensions ? [] }:
+
+/*
+  `vscodeExtensions`
+   :  A set of vscode extensions to be installed alongside the editor. Here's a an
+      example:
+
+      ~~~
+      vscode-with-extensions.override {
+
+        # When the extension is already available in the default extensions set.
+        vscodeExtensions = with vscode-extensions; [
+          bbenoist.nix
+        ]
+
+        # Concise version from the vscode market place when not available in the default set.
+        ++ vscode-utils.extensionsFromVscodeMarketplace [
+          {
+            name = "code-runner";
+            publisher = "formulahendry";
+            version = "0.6.33";
+            sha256 = "166ia73vrcl5c9hm4q1a73qdn56m0jc7flfsk5p5q41na9f10lb0";
+          }
+        ];
+      }
+      ~~~
+
+      This expression should fetch
+       -  the *nix* vscode extension from whatever source defined in the
+          default nixpkgs extensions set `vscodeExtensions`.
+
+       -  the *code-runner* vscode extension from the marketplace using the
+          following url:
+
+          ~~~
+          https://bbenoist.gallery.vsassets.io/_apis/public/gallery/publisher/bbenoist/extension/nix/1.0.1/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
+          ~~~
+
+      The original `code` executable will be wrapped so that it uses the set of pre-installed / unpacked
+      extensions as its `--extensions-dir`.
+*/
+
+let
+  inherit (vscode) executableName longName;
+  wrappedPkgVersion = lib.getVersion vscode;
+  wrappedPkgName = lib.removeSuffix "-${wrappedPkgVersion}" vscode.name;
+
+  combinedExtensionsDrv = buildEnv {
+    name = "vscode-extensions";
+    paths = vscodeExtensions;
+  };
+
+  extensionsFlag = lib.optionalString (vscodeExtensions != []) ''
+    --add-flags "--extensions-dir ${combinedExtensionsDrv}/share/vscode/extensions"
+  '';
+in
+
+# When no extensions are requested, we simply redirect to the original
+# non-wrapped vscode executable.
+runCommand "${wrappedPkgName}-with-extensions-${wrappedPkgVersion}" {
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ vscode ];
+  dontPatchELF = true;
+  dontStrip = true;
+  meta = vscode.meta;
+} (if stdenv.isDarwin then ''
+  mkdir -p $out/bin/
+  mkdir -p "$out/Applications/${longName}.app/Contents/MacOS"
+
+  for path in PkgInfo Frameworks Resources _CodeSignature Info.plist; do
+    ln -s "${vscode}/Applications/${longName}.app/Contents/$path" "$out/Applications/${longName}.app/Contents/"
+  done
+
+  makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${extensionsFlag}
+  makeWrapper "${vscode}/Applications/${longName}.app/Contents/MacOS/Electron" "$out/Applications/${longName}.app/Contents/MacOS/Electron" ${extensionsFlag}
+'' else ''
+  mkdir -p "$out/bin"
+  mkdir -p "$out/share/applications"
+  mkdir -p "$out/share/pixmaps"
+
+  ln -sT "${vscode}/share/pixmaps/code.png" "$out/share/pixmaps/code.png"
+  ln -sT "${vscode}/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop"
+  ln -sT "${vscode}/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop"
+  makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${extensionsFlag}
+'')