Change:
<ins> { lib, stdenv, fetchFromGitHub, makeWrapper, runCommand , cacert, moreutils, jq, git, pkg-config, yarn, python3 , esbuild, nodejs-14_x, libsecret, xorg, ripgrep , AppKit, Cocoa, Security, cctools }: let system = stdenv.hostPlatform.system; nodejs = nodejs-14_x; yarn' = yarn.override { inherit nodejs; }; defaultYarnOpts = [ "frozen-lockfile" "non-interactive" "no-progress"]; vsBuildTarget = { x86_64-linux = "linux-x64"; aarch64-linux = "linux-arm64"; x86_64-darwin = "darwin"; }.${system} or (throw "Unsupported system ${system}"); # replaces esbuild's download script with a binary from nixpkgs patchEsbuild = path : version : '' mkdir -p ${path}/node_modules/esbuild/bin jq "del(.scripts.postinstall)" ${path}/node_modules/esbuild/package.json | sponge ${path}/node_modules/esbuild/package.json sed -i 's/${version}/${esbuild.version}/g' ${path}/node_modules/esbuild/lib/main.js ln -s -f ${esbuild}/bin/esbuild ${path}/node_modules/esbuild/bin/esbuild ''; in stdenv.mkDerivation rec { pname = "openvscode-server"; version = "1.62.0"; src = fetchFromGitHub { owner = "gitpod-io"; repo = "openvscode-server"; rev = "openvscode-server-v${version}"; sha256 = "0lmka1hgf1703h70s7i2lx07535n2l867kmnc5h89c4vaswy6649"; }; yarnCache = stdenv.mkDerivation { name = "${pname}-${version}-${system}-yarn-cache"; inherit src; nativeBuildInputs = [ cacert yarn git ]; buildPhase = '' export HOME=$PWD yarn config set yarn-offline-mirror $out find "$PWD" -name "yarn.lock" -printf "%hn" |  xargs -I {} yarn --cwd {}  --frozen-lockfile --ignore-scripts --ignore-platform  --ignore-engines --no-progress --non-interactive ''; installPhase = '' echo yarnCache ''; outputHashMode = "recursive"; outputHashAlgo = "sha256"; outputHash = "142m0vkddzv09rbbqw7y7x19q7akkn00dn6az5ppr86k6bmhyk6p"; }; # Extract the Node.js source code which is used to compile packages with # native bindings nodeSources = runCommand "node-sources" {} '' tar --no-same-owner --no-same-permissions -xf ${nodejs.src} mv node-* $out ''; nativeBuildInputs = [ nodejs yarn' python3 pkg-config makeWrapper git jq moreutils ]; buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ] ++ (with xorg; [ libX11 libxkbfile ]) ++ lib.optionals stdenv.isDarwin [ AppKit Cocoa Security cctools ]; patches = [ # Patch out remote download of nodejs from build script ./remove-node-download.patch ]; postPatch = '' export HOME=$PWD # remove all built-in extensions, as these are 3rd party extensions that # get downloaded from vscode marketplace jq --slurp '.[0] * .[1]' "product.json" <( cat << EOF { "builtInExtensions": [] } EOF ) | sponge product.json ''; configurePhase = '' # set default yarn opts ${lib.concatMapStrings (option: '' yarn --offline config set ${option} '') defaultYarnOpts} # set offline mirror to yarn cache we created in previous steps yarn --offline config set yarn-offline-mirror "${yarnCache}" '' + lib.optionalString stdenv.isLinux '' # set nodedir, so we can build binaries later npm config set nodedir "${nodeSources}" ''; buildPhase = '' # install dependencies yarn --offline --ignore-scripts # run yarn install everywhere, skipping postinstall so we can patch esbuild find . -path "*node_modules" -prune -o  -path "./*/*" -name "yarn.lock" -printf "%hn" |  xargs -I {} yarn --cwd {}  --frozen-lockfile --offline --ignore-scripts --ignore-engines ${patchEsbuild "./build" "0.12.6"} ${patchEsbuild "./extensions" "0.11.23"} # patch shebangs of node_modules to allow binary packages to build patchShebangs ./remote/node_modules # put ripgrep binary into bin so postinstall does not try to download it find -name vscode-ripgrep -type d  -execdir mkdir -p {}/bin ;  -execdir ln -s ${ripgrep}/bin/rg {}/bin/rg ; '' + lib.optionalString stdenv.isDarwin '' # use prebuilt binary for @parcel/watcher, which requires macOS SDK 10.13+ # (see issue #101229) pushd ./remote/node_modules/@parcel/watcher mkdir -p ./build/Release mv ./prebuilds/darwin-x64/node.napi.glibc.node ./build/Release/watcher.node jq "del(.scripts) | .gypfile = false" ./package.json | sponge ./package.json popd '' + '' # rebuild binaries, we use npm here, as yarn does not provide an alternative # that would not attempt to try to reinstall everything and break our # patching attempts npm --prefix ./remote rebuild --build-from-source # run postinstall scripts after patching find . -path "*node_modules" -prune -o  -path "./*/*" -name "yarn.lock" -printf "%hn" |  xargs -I {} sh -c 'jq -e ".scripts.postinstall" {}/package.json >/dev/null && yarn --cwd {} postinstall --frozen-lockfile --offline || true' # build and minify yarn --offline gulp vscode-reh-web-${vsBuildTarget}-min ''; installPhase = '' mkdir -p $out/libexec cp -R -T ../vscode-reh-web-${vsBuildTarget} "$out/libexec" ln -s ${nodejs}/bin/node $out/libexec makeWrapper "$out/libexec/server.sh" "$out/bin/openvscode-server" ''; meta = with lib; { description = "Run VS Code on a remote machine"; longDescription = '' Run upstream VS Code on a remote machine with access through a modern web browser from any device, anywhere. ''; homepage = "https://github.com/gitpod-io/openvscode-server"; license = licenses.mit; maintainers = with maintainers; [ dguenther ghuntley ]; platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; }; } </ins>

Discussion:
Project description It's like but closer to upstream, as I understand it. Maybe this can be packaged similarly to how is packaged? shamelessly ccing past code-server contributors: (hi!) and maybe would be interested, or maybe has a nix derivation already? Metadata homepage URL: source URL: license: mit platforms: linux
from Gitpod. I am pretty close to finishing packaging this. Happy to open a WIP and get the help of others to finish up. was causing me grief but is now fixed.
Oh cool, this would be great to have packaged! Feel free to cc me if you run into any sticking points, I'd be glad to take a look.
Hey folks ( ) can I get your help with getting this over the line? Problems experienced: esbuild continues to attempt downloading linux binaries during the compilation phase in a pure environment
Sure, let me try to find some time to poke around at it this week. My guess is that inserting the binary using will be the way to go, and it might be easier/more reliable to compile esbuild in the derivation rather than trying to install a prebuild in one of the earlier phases and copy it through.
I hope so; what I experienced was esbuild attempting to pull binaries from the internet during the build phase. Wasn’t aware of ESBUILDBINARYPARTH. I tried to mitigate via bumping esbuild version (thus explaining why using my fork)
Made some progress -- There are two separate versions of esbuild in the project, one in the root and one in extensions. runs a script that executes in a few other directories, which then triggers another that attempts to download esbuild. I think you were on the right track with adding to that postinstall script, but it seemed a bit tricky to replace via substitution. We could probably patch it instead, but I ended up just reimplementing the postinstall script with and building the necessary esbuild versions within the derivation. It got further along in the build, but I think it's looking for the node sources now: I'll have some more time this weekend to make progress on it, but here's my WIP branch:
I have a working version pushed up on the branch I linked in my previous comment.

I tested it runs on both Darwin and Linux x64, but I haven't extensively QAed it to make sure everything works as expected. Would you like to take over submitting a PR for it? I can do it if you prefer, but since you got the ball rolling, I wanted to give you the opportunity if you're interested
I'm back to being curious about this. GitPod is just very precise about mostly having achieved their goal and about trying to be as minimal as possible to enable the in browser experience properly. They have a new blog post:
Sounds good, I'll clean up my branch based on code review I received in and put up a PR for it tonight. I haven't done much research into it, but I'm interested to see if MS will publish any of the work they've made in this direction, either on or GitHub CodeSpaces. Neither of them are exactly comparable to code-server/openvscode-server, but it's nice to see a variety of projects making progress in that direction.
Some updates on OpenVSCode server!
Oh, I read the above blog post and it looks like they did, that's great! PR for this issue is open ^
Thanks a bunch this is really cool and powerful to have available via Nix! I'm very curious to see where upstream/openvscode/code-server go, especially in terms of things like Auth. It'd be neat to be able to tell VSCode to take accept auth information passed via headers, or pass it JWS info to validate a JWT header or something. Although if it's remaining single-user, just disabling auth and letting the reverse proxy handle it seems as elegant as anything. Anyway, thanks again!
Also, I just did notice a difference. OpenVSCode server blocked me from installing extensions that Code-Server allowed (or maybe isn't new enough to try and block?). And I don't have an override but there might exist a way? Are you on the OpenVSCodeServer Discord , or are you both maybe on Matrix? We could spin up a room to share notes?

(EDIT: turns out the one extension it did block was the bracket colorizer, but 1) it wasn't working in code-server anyway, and 2) I think there was a blog post and it's going to become built-in)
I'm not in either yet, but I'll hop in the OpenVSCodeServer/Gitpod Discord at least! I know at least one improvement that would be nice to make would be adding back the built-in extensions -- I saw there's a directory in nixpkgs that might work for building the extensions.