git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #101628 from dguenther/code-server3.6.0

code-server: 3.4.1 -> 3.6.0

commitcc8db6e19b876e0ee484d8e186fc689ce1e18f6b authorSandro <sandro.jaeckel@gmail.com> dateThu 7 Jan 2021, 17:25 (6 years ago) parentec56bf6680df51
1 file changed+47−9
pkgs/servers/code-server/default.nix+47−9
pkgs/servers/code-server/default.nix+47−9
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, makeWrapper, runCommand
1+{ stdenv, fetchFromGitHub, buildGoModule, makeWrapper, runCommand
22, moreutils, jq, git, zip, rsync, pkgconfig, yarn, python2
33, nodejs-12_x, libsecret, xorg, ripgrep, nettools }:
44
@@ -12,17 +12,31 @@ let
1212
1313in stdenv.mkDerivation rec {
1414 pname = "code-server";
15− version = "3.4.1";
16− commit = "d3773c11f147bdd7a4f5acfefdee23c26f069e76";
15+ version = "3.6.0";
16+ commit = "a4a03c14922ccaec2a9ff8d1b7b2af8522a4214d";
1717
1818 src = fetchFromGitHub {
1919 owner = "cdr";
2020 repo = "code-server";
21− rev = version;
22− sha256 = "PfDD0waloppGZ09zCQ9ggBeVL/Dhfv6QmEs/fs7QLtA=";
21+ rev = "v${version}";
22+ sha256 = "1c0p1s0bl3az5ysl97mz3gbynyndz6jd2jj7lx2snz6jqqd43y9p";
2323 fetchSubmodules = true;
2424 };
2525
26+ cloudAgent = buildGoModule rec {
27+ pname = "cloud-agent";
28+ version = "0.1.0";
29+
30+ src = fetchFromGitHub {
31+ owner = "cdr";
32+ repo = "cloud-agent";
33+ rev = version;
34+ sha256 = "1p20cvgvs38604km9ixylz0r3k7blkd80lncmma3z05y5n5fqps1";
35+ };
36+
37+ vendorSha256 = "0yky1v1ak3ysykjf3gm1hd7qyj5rm4fw7amga81sb31x0357jlzr";
38+ };
39+
2640 yarnCache = stdenv.mkDerivation {
2741 name = "${pname}-${version}-${system}-yarn-cache";
2842 inherit src;
@@ -45,10 +59,10 @@ in stdenv.mkDerivation rec {
4559 outputHashMode = "recursive";
4660 outputHashAlgo = "sha256";
4761
48− # to get hash values use nix-build -A code-server.yarnPrefetchCache
62+ # to get hash values use nix-build -A code-server.prefetchYarnCache
4963 outputHash = {
50− x86_64-linux = "Zze2hEm2Np+SyQ0KXy5CZr5wilZbHBYXNYcRJBUUkQo=";
51− aarch64-linux = "LiIvGuBismWSL2yV2DuKUWDjIzuIQU/VVxtiD4xJ+6Q=";
64+ x86_64-linux = "1443qwkllb714s4qw3b9y1mcc6p2ykgc02pw2k3z2gczvvr0g8qv";
65+ aarch64-linux = "1443qwkllb714s4qw3b9y1mcc6p2ykgc02pw2k3z2gczvvr0g8qv";
5266 }.${system} or (throw "Unsupported system ${system}");
5367 };
5468
@@ -64,7 +78,7 @@ in stdenv.mkDerivation rec {
6478 ];
6579 buildInputs = [ libsecret xorg.libX11 xorg.libxkbfile ];
6680
67− patchPhase = ''
81+ postPatch = ''
6882 export HOME=$PWD
6983
7084 patchShebangs ./ci
@@ -76,6 +90,21 @@ in stdenv.mkDerivation rec {
7690 substituteInPlace lib/vscode/build/npm/postinstall.js \
7791 --replace '--ignore-optional' '--offline'
7892
93+ # remove unnecessary git config command
94+ substituteInPlace lib/vscode/build/npm/postinstall.js \
95+ --replace "cp.execSync('git config pull.rebase true');" ""
96+
97+ # allow offline install for postinstall scripts in extensions
98+ grep -rl "yarn install" --include package.json lib/vscode/extensions \
99+ | xargs sed -i 's/yarn install/yarn install --offline/g'
100+
101+ # remove download of coder-cloud agent
102+ sed -i ':a;N;$!ba;s/OS=.*agent//' ci/build/npm-postinstall.sh
103+
104+ # use offline cache when installing release packages
105+ substituteInPlace ci/build/npm-postinstall.sh \
106+ --replace 'yarn --production' 'yarn --production --offline'
107+
79108 # fix path to ifconfig, so vscode can get mac address
80109 substituteInPlace lib/vscode/src/vs/base/node/macAddress.ts \
81110 --replace '/sbin/ifconfig' '${nettools}/bin/ifconfig'
@@ -111,8 +140,14 @@ in stdenv.mkDerivation rec {
111140 # set nodedir, so we can build binaries later
112141 npm config set nodedir "${nodeSources}"
113142
143+ # link coder-cloud agent from nix store
144+ ln -s "${cloudAgent}/bin/cloud-agent" ./lib/coder-cloud-agent
145+
114146 # skip browser downloads for playwright
115147 export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD="true"
148+
149+ # skip unnecessary electron download
150+ export ELECTRON_SKIP_BINARY_DOWNLOAD=1
116151 '';
117152
118153 buildPhase = ''
@@ -162,6 +197,9 @@ in stdenv.mkDerivation rec {
162197 # install only production dependencies
163198 yarn --offline --cwd "$out/libexec/code-server" --production
164199
200+ # link coder-cloud agent from nix store
201+ ln -s "${cloudAgent}/bin/cloud-agent" $out/libexec/code-server/lib/coder-cloud-agent
202+
165203 # create wrapper
166204 makeWrapper "${nodejs-12_x}/bin/node" "$out/bin/code-server" \
167205 --add-flags "$out/libexec/code-server/out/node/entry.js"