···11{ lib
22+, nixosTests
23, vscode-utils
34, useLocalExtensions ? false
45}:
···89910let
1011 inherit (vscode-utils) buildVscodeMarketplaceExtension;
1111-1212- nodeVersion = "16";
13121413 # As VS Code executes this code on the remote machine
1514 # we test to see if we can build Node from Nixpkgs
···2322 serverNode="$serverDir/node"
2423 echo "VS Code Node: $serverNode"
25242626- # Check if VS Code Server has a non-working Node or the wrong version of Node
2727- if ! nodeVersion=$($serverNode -v) || [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then
2525+ # Check if Node included with VS Code Server runs
2626+ if ! nodeVersion=$($serverNode -v); then
2827 echo "VS Code Node Version: $nodeVersion"
29283030- if nix-build "<nixpkgs>" -A nodejs-${nodeVersion}_x --out-link "$serverDir/nix" && [ -e "$serverDir/nix/bin/node" ]; then
3131- nodePath="$serverDir/nix/bin/node"
2929+ if ! nix-build "<nixpkgs>" -A patchelf --out-link "$serverDir/patchelf" || ! "$serverDir/patchelf/bin/patchelf" --version; then
3030+ echo "Failed to get patchelf from nixpkgs"
3231 fi
33323434- echo "Node from Nix: $nodePath"
3333+ if [ -e $serverNode.orig ]; then
3434+ cp $serverNode.orig $serverNode
3535+ else
3636+ cp $serverNode $serverNode.orig
3737+ fi
35383636- nodeVersion=$($nodePath -v)
3737- echo "Node from Nix Version: $nodeVersion"
3939+ if ! nix-build "<nixpkgs>" -A bintools --out-link $serverDir/bintools; then
4040+ echo "Failed to build bintools from nixpkgs"
4141+ fi
4242+4343+ INTERPRETER=$(cat $serverDir/bintools/nix-support/dynamic-linker)
4444+4545+ echo "Interpreter from bintools: $INTERPRETER"
38463939- if [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then
4040- echo "Getting Node from Nix failed, use Local Node instead"
4141- nodePath=$(which node)
4242- echo "Local Node: $nodePath"
4343- nodeVersion=$($nodePath -v)
4444- echo "Local Node Version: $nodeVersion"
4747+ if ! nix-build "<nixpkgs>" -A stdenv.cc.cc.lib --out-link $serverDir/cc; then
4848+ echo "Failed to build stdenv.cc.cc.lib from nixpkgs"
4549 fi
46504747- if [ "\''${nodeVersion:1:2}" == "${nodeVersion}" ]; then
4848- echo PATCH: replacing $serverNode with $nodePath
4949- ln -sf $nodePath $serverNode
5151+ if ! $serverDir/patchelf/bin/patchelf --set-interpreter $INTERPRETER --set-rpath $serverDir/cc-lib/lib $serverNode; then
5252+ echo "Failed to patch Node binary"
5053 fi
5454+5555+ rm "$serverDir/patchelf"
5156 fi
52575358 nodeVersion=$($serverNode -v)
5459 echo "VS Code Node Version: $nodeVersion"
55605656- if [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then
5757- echo "Unsupported VS Code Node version: $nodeVersion", quitting
6161+ if ! nodeVersion=$($serverNode -v); then
6262+ echo "Unable to fix Node binary, quitting"
5863 fail_with_exitcode ''${o.InstallExitCode.ServerTransferFailed}
5964 fi
6065···8691 substituteInPlace "out/extension.js" \
8792 --replace '# Start the server\n' '${patch}'
8893 '';
9494+9595+ passthru.tests = { inherit (nixosTests) vscode-remote-ssh; };
89969097 meta = {
9198 description = "Use any remote machine with a SSH server as your development environment.";
+4
pkgs/applications/editors/vscode/generic.nix
···1313, version, src, meta, sourceRoot, commandLineArgs
1414, executableName, longName, shortName, pname, updateScript
1515, dontFixup ? false
1616+, rev ? null, vscodeServer ? null
1717+1618# sourceExecutableName is the name of the binary in the source archive, over
1719# which we have no control
1820, sourceExecutableName ? executableName
···3032 inherit executableName longName tests updateScript;
3133 fhs = fhs {};
3234 fhsWithPackages = f: fhs { additionalPkgs = f; };
3535+ } // lib.optionalAttrs (vscodeServer != null) {
3636+ inherit rev vscodeServer;
3337 };
34383539 desktopItem = makeDesktopItem {
···11-{ stdenv, lib, callPackage, fetchurl
11+{ stdenv
22+, lib
33+, callPackage
44+, fetchurl
55+, nixosTests
66+, srcOnly
27, isInsiders ? false
38, commandLineArgs ? ""
49, useVSCodeRipgrep ? stdenv.isDarwin
···3237 version = "1.79.1";
3338 pname = "vscode";
34394040+ # This is used for VS Code - Remote SSH test
4141+ rev = "b380da4ef1ee00e224a15c1d4d9793e27c2b6302";
4242+3543 executableName = "code" + lib.optionalString isInsiders "-insiders";
3644 longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders";
3745 shortName = "Code" + lib.optionalString isInsiders " - Insiders";
···48564957 sourceRoot = "";
50585959+ # As tests run without networking, we need to download this for the Remote SSH server
6060+ vscodeServer = srcOnly {
6161+ name = "vscode-server-${rev}.tar.gz";
6262+ src = fetchurl {
6363+ name = "vscode-server-${rev}.tar.gz";
6464+ url = "https://update.code.visualstudio.com/commit:${rev}/server-linux-x64/stable";
6565+ sha256 = "0732wpl4fjknhn423k23zrcqz9psjj1iy8lqa0fc8970n1m7i58b";
6666+ };
6767+ };
6868+6969+ tests = { inherit (nixosTests) vscode-remote-ssh; };
7070+5171 updateScript = ./update-vscode.sh;
52725373 # Editing the `code` binary within the app bundle causes the bundle's signature
···7191 homepage = "https://code.visualstudio.com/";
7292 downloadPage = "https://code.visualstudio.com/Updates";
7393 license = licenses.unfree;
7474- maintainers = with maintainers; [ eadwu synthetica maxeaubrey bobby285271 ];
9494+ maintainers = with maintainers; [ eadwu synthetica maxeaubrey bobby285271 Enzime ];
7595 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" "armv7l-linux" ];
7696 };
7797 }
+1-2
pkgs/build-support/src-only/default.nix
···11{ stdenv }:
22# srcOnly is a utility builder that only fetches and unpacks the given `src`,
33-# maybe pathings it in the process with the optional `patches` and
44-# `buildInputs` attributes.
33+# and optionally patching with `patches` or adding build inputs.
54#
65# It can be invoked directly, or be used to wrap an existing derivation. Eg:
76#