mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
125 lines
4.1 KiB
Nix
125 lines
4.1 KiB
Nix
{
|
|
stdenv,
|
|
stdenvNoCC,
|
|
lib,
|
|
callPackage,
|
|
fetchurl,
|
|
nixosTests,
|
|
srcOnly,
|
|
isInsiders ? false,
|
|
# sourceExecutableName is the name of the binary in the source archive over
|
|
# which we have no control and it is needed to run the insider version as
|
|
# documented in https://wiki.nixos.org/wiki/Visual_Studio_Code#Insiders_Build
|
|
# On MacOS the insider binary is still called code instead of code-insiders as
|
|
# of 2023-08-06.
|
|
sourceExecutableName ?
|
|
"code" + lib.optionalString (isInsiders && stdenv.hostPlatform.isLinux) "-insiders",
|
|
commandLineArgs ? "",
|
|
useVSCodeRipgrep ? stdenv.hostPlatform.isDarwin,
|
|
}:
|
|
|
|
let
|
|
inherit (stdenv.hostPlatform) system;
|
|
throwSystem = throw "Unsupported system: ${system}";
|
|
|
|
plat =
|
|
{
|
|
x86_64-linux = "linux-x64";
|
|
x86_64-darwin = "darwin";
|
|
aarch64-linux = "linux-arm64";
|
|
aarch64-darwin = "darwin-arm64";
|
|
armv7l-linux = "linux-armhf";
|
|
}
|
|
.${system} or throwSystem;
|
|
|
|
archive_fmt = if stdenv.hostPlatform.isDarwin then "zip" else "tar.gz";
|
|
|
|
sha256 =
|
|
{
|
|
x86_64-linux = "0kd4nb8b17j7ii5lhq4cih62pghb4j9gylgz9yqippxivzzkq6dd";
|
|
x86_64-darwin = "1y96sp3lkm32fnhjak2js11m9qf8155gglp9g83ynv9d8sdy14ya";
|
|
aarch64-linux = "162wac7s0l4pq6r6sh32lh69j90rna430z57ksb6g9w8spqzqnv4";
|
|
aarch64-darwin = "1rqq131f1hs2z14ddh7sp6flwsgb58r8nw1ydbcclcmzi3vbdgr9";
|
|
armv7l-linux = "06czqpzwlrx98bv2vmawjxxmzw9z6bcfxikp7nxhi8qp8nsjfvgy";
|
|
}
|
|
.${system} or throwSystem;
|
|
in
|
|
callPackage ./generic.nix rec {
|
|
# Please backport all compatible updates to the stable release.
|
|
# This is important for the extension ecosystem.
|
|
version = "1.100.3";
|
|
pname = "vscode" + lib.optionalString isInsiders "-insiders";
|
|
|
|
# This is used for VS Code - Remote SSH test
|
|
rev = "258e40fedc6cb8edf399a463ce3a9d32e7e1f6f3";
|
|
|
|
executableName = "code" + lib.optionalString isInsiders "-insiders";
|
|
longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders";
|
|
shortName = "Code" + lib.optionalString isInsiders " - Insiders";
|
|
inherit commandLineArgs useVSCodeRipgrep sourceExecutableName;
|
|
|
|
src = fetchurl {
|
|
name = "VSCode_${version}_${plat}.${archive_fmt}";
|
|
url = "https://update.code.visualstudio.com/${version}/${plat}/stable";
|
|
inherit sha256;
|
|
};
|
|
|
|
# We don't test vscode on CI, instead we test vscodium
|
|
tests = { };
|
|
|
|
sourceRoot = "";
|
|
|
|
# As tests run without networking, we need to download this for the Remote SSH server
|
|
vscodeServer = srcOnly {
|
|
name = "vscode-server-${rev}.tar.gz";
|
|
src = fetchurl {
|
|
name = "vscode-server-${rev}.tar.gz";
|
|
url = "https://update.code.visualstudio.com/commit:${rev}/server-linux-x64/stable";
|
|
sha256 = "0bd04p4i5hkkccglw5x3vxf4vbq9hj83gdwfnaps5yskcqizhw77";
|
|
};
|
|
stdenv = stdenvNoCC;
|
|
};
|
|
|
|
tests = { inherit (nixosTests) vscode-remote-ssh; };
|
|
|
|
updateScript = ./update-vscode.sh;
|
|
|
|
# Editing the `code` binary within the app bundle causes the bundle's signature
|
|
# to be invalidated, which prevents launching starting with macOS Ventura, because VS Code is notarized.
|
|
# See https://eclecticlight.co/2022/06/17/app-security-changes-coming-in-ventura/ for more information.
|
|
dontFixup = stdenv.hostPlatform.isDarwin;
|
|
|
|
hasVsceSign = true;
|
|
|
|
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
|
|
bobby285271
|
|
johnrtitor
|
|
jefflabonte
|
|
];
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
"aarch64-linux"
|
|
"armv7l-linux"
|
|
];
|
|
};
|
|
}
|