-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Expand file tree
/
Copy pathvscode.nix
More file actions
134 lines (118 loc) · 4.35 KB
/
vscode.nix
File metadata and controls
134 lines (118 loc) · 4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
lib,
stdenv,
stdenvNoCC,
buildVscode,
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";
hash =
{
x86_64-linux = "sha256-zoe2E9xlpAME4QD8IagicbAj71g3cA9XlymQQQMFJLo=";
x86_64-darwin = "sha256-gKpy6+wkcO+znxLdkGMOetpVyhs3SViQyRtCc6yc5XY=";
aarch64-linux = "sha256-KQR6zD+3m+OgeICSs3LkWo7kC2OxqF6Xax8BRTa6QYQ=";
aarch64-darwin = "sha256-VZufcJ/g1LPtlQruUwI8Pe5c8LNiAIUHY5+gNnyaPTQ=";
armv7l-linux = "sha256-0TxKXKQppxcURimXgC40wmqMgiX3DBMJAMc+qjMQCck=";
}
.${system} or throwSystem;
# Please backport all compatible updates to the stable release.
# This is important for the extension ecosystem.
version = "1.116.0";
# The update server (update.code.visualstudio.com) expects the version path
# segment in X.Y.Z form, so we normalize X.Y to X.Y.0 (e.g. "1.110" → "1.110.0").
# Upstream GitHub release tags may use X.Y, which is why this normalization is needed.
downloadVersion = lib.versions.pad 3 version;
# This is used for VS Code - Remote SSH test
rev = "560a9dba96f961efea7b1612916f89e5d5d4d679";
in
buildVscode {
pname = "vscode" + lib.optionalString isInsiders "-insiders";
executableName = "code" + lib.optionalString isInsiders "-insiders";
longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders";
shortName = "Code" + lib.optionalString isInsiders " - Insiders";
inherit
version
rev
commandLineArgs
useVSCodeRipgrep
sourceExecutableName
;
src = fetchurl {
name = "VSCode_${downloadVersion}_${plat}.${archive_fmt}";
url = "https://update.code.visualstudio.com/${downloadVersion}/${plat}/stable";
inherit hash;
};
# 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";
hash = "sha256-HqcaLktkhw3BoEgyFwnMmP7/vuSl1OXZygrQreKeHnM=";
};
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 = {
description = "Code editor developed by Microsoft";
mainProgram = "code";
longDescription = ''
Code editor developed by Microsoft. 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 = lib.licenses.unfree;
maintainers = with lib.maintainers; [
eadwu
bobby285271
johnrtitor
jefflabonte
wetrustinprize
oenu
yuannan
];
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
"aarch64-linux"
"armv7l-linux"
];
};
}