code-server: 3.12.0 -> 4.0.1

+80 -43
+43 -35
pkgs/servers/code-server/default.nix
··· 1 { lib, stdenv, fetchFromGitHub, buildGoModule, makeWrapper, runCommand 2 - , moreutils, jq, git, cacert, zip, rsync, pkg-config, yarn, python3 3 - , esbuild, nodejs-14_x, libsecret, xorg, ripgrep 4 - , AppKit, Cocoa, Security, cctools }: 5 6 let 7 system = stdenv.hostPlatform.system; ··· 11 yarn' = yarn.override { inherit nodejs; }; 12 defaultYarnOpts = [ "frozen-lockfile" "non-interactive" "no-progress"]; 13 14 in stdenv.mkDerivation rec { 15 pname = "code-server"; 16 - version = "3.12.0"; 17 - commit = "798dc0baf284416dbbf951e4ef596beeab6cb6c4"; 18 19 src = fetchFromGitHub { 20 owner = "cdr"; 21 repo = "code-server"; 22 rev = "v${version}"; 23 - sha256 = "17v3sz0wjrmikmzyh9xswr4kf1vcj9njlibqb4wwj0pq0d72wdvl"; 24 }; 25 26 cloudAgent = buildGoModule rec { ··· 63 outputHashAlgo = "sha256"; 64 65 # to get hash values use nix-build -A code-server.prefetchYarnCache 66 - outputHash = { 67 - x86_64-linux = "1clfdl9hy5j2dj6jj6a9vgq0wzllfj0h2hbb73959k3w85y4ad2w"; 68 - aarch64-linux = "1clfdl9hy5j2dj6jj6a9vgq0wzllfj0h2hbb73959k3w85y4ad2w"; 69 - x86_64-darwin = "1clfdl9hy5j2dj6jj6a9vgq0wzllfj0h2hbb73959k3w85y4ad2w"; 70 - }.${system} or (throw "Unsupported system ${system}"); 71 }; 72 73 - # Extract the Node.js source code which is used to compile packages with 74 - # native bindings 75 - nodeSources = runCommand "node-sources" {} '' 76 - tar --no-same-owner --no-same-permissions -xf ${nodejs.src} 77 - mv node-* $out 78 - ''; 79 - 80 nativeBuildInputs = [ 81 - nodejs yarn' python pkg-config zip makeWrapper git rsync jq moreutils 82 ]; 83 buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ] 84 ++ (with xorg; [ libX11 libxkbfile ]) 85 ++ lib.optionals stdenv.isDarwin [ 86 - AppKit Cocoa Security cctools 87 ]; 88 89 patches = [ ··· 119 120 # skip unnecessary electron download 121 export ELECTRON_SKIP_BINARY_DOWNLOAD=1 122 - '' + lib.optionalString stdenv.isLinux '' 123 - # set nodedir, so we can build binaries later 124 - npm config set nodedir "${nodeSources}" 125 ''; 126 127 buildPhase = '' ··· 169 # sw_vers before that variable is checked. 170 patch -p1 -i ${./playwright.patch} 171 172 # Replicate install vscode dependencies without running script for all vscode packages 173 # that require patching for postinstall scripts to succeed 174 find ./vendor/modules/code-oss-dev -path "*node_modules" -prune -o \ 175 -path "./*/*/*/*/*" -name "yarn.lock" -printf "%h\n" | \ 176 xargs -I {} yarn --cwd {} \ 177 --frozen-lockfile --offline --ignore-scripts --ignore-engines 178 179 # patch shebangs of everything to allow binary packages to build 180 patchShebangs . 181 182 - # patch build esbuild 183 - mkdir -p vendor/modules/code-oss-dev/build/node_modules/esbuild/bin 184 - jq "del(.scripts.postinstall)" vendor/modules/code-oss-dev/build/node_modules/esbuild/package.json | sponge vendor/modules/code-oss-dev/build/node_modules/esbuild/package.json 185 - sed -i 's/0.12.6/${esbuild.version}/g' vendor/modules/code-oss-dev/build/node_modules/esbuild/lib/main.js 186 - ln -s -f ${esbuild}/bin/esbuild vendor/modules/code-oss-dev/build/node_modules/esbuild/bin/esbuild 187 - 188 - # patch extensions esbuild 189 - mkdir -p vendor/modules/code-oss-dev/extensions/node_modules/esbuild/bin 190 - jq "del(.scripts.postinstall)" vendor/modules/code-oss-dev/extensions/node_modules/esbuild/package.json | sponge vendor/modules/code-oss-dev/extensions/node_modules/esbuild/package.json 191 - sed -i 's/0.11.12/${esbuild.version}/g' vendor/modules/code-oss-dev/extensions/node_modules/esbuild/lib/main.js 192 - ln -s -f ${esbuild}/bin/esbuild vendor/modules/code-oss-dev/extensions/node_modules/esbuild/bin/esbuild 193 - 194 # rebuild binaries, we use npm here, as yarn does not provide an alternative 195 # that would not attempt to try to reinstall everything and break our 196 # patching attempts
··· 1 { lib, stdenv, fetchFromGitHub, buildGoModule, makeWrapper, runCommand 2 + , cacert, moreutils, jq, git, rsync, pkg-config, yarn, python3 3 + , esbuild, nodejs-14_x, node-gyp, libsecret, xorg, ripgrep 4 + , AppKit, Cocoa, CoreServices, Security, cctools, xcbuild }: 5 6 let 7 system = stdenv.hostPlatform.system; ··· 11 yarn' = yarn.override { inherit nodejs; }; 12 defaultYarnOpts = [ "frozen-lockfile" "non-interactive" "no-progress"]; 13 14 + # replaces esbuild's download script with a binary from nixpkgs 15 + patchEsbuild = path : version : '' 16 + mkdir -p ${path}/node_modules/esbuild/bin 17 + jq "del(.scripts.postinstall)" ${path}/node_modules/esbuild/package.json | sponge ${path}/node_modules/esbuild/package.json 18 + sed -i 's/${version}/${esbuild.version}/g' ${path}/node_modules/esbuild/lib/main.js 19 + ln -s -f ${esbuild}/bin/esbuild ${path}/node_modules/esbuild/bin/esbuild 20 + ''; 21 + 22 in stdenv.mkDerivation rec { 23 pname = "code-server"; 24 + version = "4.0.1"; 25 + commit = "7fe23daf009e5234eaa54a1ea5ff26df384c47ac"; 26 27 src = fetchFromGitHub { 28 owner = "cdr"; 29 repo = "code-server"; 30 rev = "v${version}"; 31 + sha256 = "1s3dcmzlkyh7qfs3ai1p7dlp45iys0ax1fbxxz17p395pw9anrrl"; 32 }; 33 34 cloudAgent = buildGoModule rec { ··· 71 outputHashAlgo = "sha256"; 72 73 # to get hash values use nix-build -A code-server.prefetchYarnCache 74 + outputHash = "0qmfsirld1qfl2s26rxbpmvxsyj2pvzkgk8w89zlrgbhgc5fj8p9"; 75 }; 76 77 nativeBuildInputs = [ 78 + nodejs yarn' python pkg-config makeWrapper git rsync jq moreutils 79 ]; 80 buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ] 81 ++ (with xorg; [ libX11 libxkbfile ]) 82 ++ lib.optionals stdenv.isDarwin [ 83 + AppKit Cocoa CoreServices Security cctools xcbuild 84 ]; 85 86 patches = [ ··· 116 117 # skip unnecessary electron download 118 export ELECTRON_SKIP_BINARY_DOWNLOAD=1 119 + 120 + # set nodedir to prevent node-gyp from downloading headers 121 + # taken from https://nixos.org/manual/nixpkgs/stable/#javascript-tool-specific 122 + mkdir -p $HOME/.node-gyp/${nodejs.version} 123 + echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion 124 + ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version} 125 + export npm_config_nodedir=${nodejs} 126 + 127 + # use updated node-gyp. fixes the following error on Darwin: 128 + # PermissionError: [Errno 1] Operation not permitted: '/usr/sbin/pkgutil' 129 + export npm_config_node_gyp=${node-gyp}/lib/node_modules/node-gyp/bin/node-gyp.js 130 ''; 131 132 buildPhase = '' ··· 174 # sw_vers before that variable is checked. 175 patch -p1 -i ${./playwright.patch} 176 177 + # Patch out remote download of nodejs from build script 178 + patch -p1 -i ${./remove-node-download.patch} 179 + 180 # Replicate install vscode dependencies without running script for all vscode packages 181 # that require patching for postinstall scripts to succeed 182 find ./vendor/modules/code-oss-dev -path "*node_modules" -prune -o \ 183 -path "./*/*/*/*/*" -name "yarn.lock" -printf "%h\n" | \ 184 xargs -I {} yarn --cwd {} \ 185 --frozen-lockfile --offline --ignore-scripts --ignore-engines 186 + 187 188 # patch shebangs of everything to allow binary packages to build 189 patchShebangs . 190 191 + ${patchEsbuild "./vendor/modules/code-oss-dev/build" "0.12.6"} 192 + ${patchEsbuild "./vendor/modules/code-oss-dev/extensions" "0.11.23"} 193 + '' + lib.optionalString stdenv.isDarwin '' 194 + # use prebuilt binary for @parcel/watcher, which requires macOS SDK 10.13+ 195 + # (see issue #101229) 196 + pushd ./vendor/modules/code-oss-dev/remote/node_modules/@parcel/watcher 197 + mkdir -p ./build/Release 198 + mv ./prebuilds/darwin-x64/node.napi.glibc.node ./build/Release/watcher.node 199 + jq "del(.scripts) | .gypfile = false" ./package.json | sponge ./package.json 200 + popd 201 + '' + '' 202 # rebuild binaries, we use npm here, as yarn does not provide an alternative 203 # that would not attempt to try to reinstall everything and break our 204 # patching attempts
+2 -2
pkgs/servers/code-server/playwright.patch
··· 4 * limitations under the License. 5 */ 6 7 - -const { installBrowsersWithProgressBar } = require('./lib/install/installer'); 8 - 9 - -installBrowsersWithProgressBar(); 10 +process.stdout.write('Browser install disabled by Nix build script\n');
··· 4 * limitations under the License. 5 */ 6 7 + -const { installDefaultBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry'); 8 - 9 + -installDefaultBrowsersForNpmInstall(); 10 +process.stdout.write('Browser install disabled by Nix build script\n');
+6 -5
pkgs/servers/code-server/remove-cloud-agent-download.patch
··· 1 --- ./ci/build/npm-postinstall.sh 2 +++ ./ci/build/npm-postinstall.sh 3 - @@ -56,13 +56,6 @@ 4 - ;; 5 - esac 6 - 7 - - OS="$(uname | tr '[:upper:]' '[:lower:]')" 8 - if curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent; then 9 - chmod +x ./lib/coder-cloud-agent 10 - else
··· 1 --- ./ci/build/npm-postinstall.sh 2 +++ ./ci/build/npm-postinstall.sh 3 + @@ -58,14 +58,6 @@ 4 + 5 + OS="$(uname | tr '[:upper:]' '[:lower:]')" 6 + 7 + - mkdir -p ./lib 8 + - 9 - if curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent; then 10 - chmod +x ./lib/coder-cloud-agent 11 - else
+27
pkgs/servers/code-server/remove-node-download.patch
···
··· 1 + --- ./vendor/modules/code-oss-dev/build/gulpfile.reh.js 2 + +++ ./vendor/modules/code-oss-dev/build/gulpfile.reh.js 3 + @@ -277,8 +277,6 @@ 4 + .pipe(util.stripSourceMappingURL()) 5 + .pipe(jsFilter.restore); 6 + 7 + - const nodePath = `.build/node/v${nodeVersion}/${platform}-${platform === 'darwin' ? 'x64' : arch}`; 8 + - const node = gulp.src(`${nodePath}/**`, { base: nodePath, dot: true }); 9 + 10 + let web = []; 11 + if (type === 'reh-web') { 12 + @@ -296,7 +294,6 @@ 13 + license, 14 + sources, 15 + deps, 16 + - node, 17 + ...web 18 + ); 19 + 20 + @@ -376,7 +373,6 @@ 21 + const destinationFolderName = `vscode-${type}${dashed(platform)}${dashed(arch)}`; 22 + 23 + const serverTaskCI = task.define(`vscode-${type}${dashed(platform)}${dashed(arch)}${dashed(minified)}-ci`, task.series( 24 + - gulp.task(`node-${platform}-${platform === 'darwin' ? 'x64' : arch}`), 25 + util.rimraf(path.join(BUILD_ROOT, destinationFolderName)), 26 + packageTask(type, platform, arch, sourceFolderName, destinationFolderName) 27 + ));
+2 -1
pkgs/top-level/all-packages.nix
··· 29365 }; 29366 29367 code-server = callPackage ../servers/code-server { 29368 - inherit (darwin.apple_sdk.frameworks) AppKit Cocoa Security; 29369 inherit (darwin) cctools; 29370 }; 29371 29372 vue = callPackage ../applications/misc/vue { };
··· 29365 }; 29366 29367 code-server = callPackage ../servers/code-server { 29368 + inherit (darwin.apple_sdk.frameworks) AppKit Cocoa CoreServices Security; 29369 inherit (darwin) cctools; 29370 + inherit (nodePackages) node-gyp; 29371 }; 29372 29373 vue = callPackage ../applications/misc/vue { };