···1{ lib
02, vscode-utils
3, useLocalExtensions ? false
4}:
···89let
10 inherit (vscode-utils) buildVscodeMarketplaceExtension;
11-12- nodeVersion = "16";
1314 # As VS Code executes this code on the remote machine
15 # we test to see if we can build Node from Nixpkgs
···23 serverNode="$serverDir/node"
24 echo "VS Code Node: $serverNode"
2526- # Check if VS Code Server has a non-working Node or the wrong version of Node
27- if ! nodeVersion=$($serverNode -v) || [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then
28 echo "VS Code Node Version: $nodeVersion"
2930- if nix-build "<nixpkgs>" -A nodejs-${nodeVersion}_x --out-link "$serverDir/nix" && [ -e "$serverDir/nix/bin/node" ]; then
31- nodePath="$serverDir/nix/bin/node"
32 fi
3334- echo "Node from Nix: $nodePath"
00003536- nodeVersion=$($nodePath -v)
37- echo "Node from Nix Version: $nodeVersion"
000003839- if [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then
40- echo "Getting Node from Nix failed, use Local Node instead"
41- nodePath=$(which node)
42- echo "Local Node: $nodePath"
43- nodeVersion=$($nodePath -v)
44- echo "Local Node Version: $nodeVersion"
45 fi
4647- if [ "\''${nodeVersion:1:2}" == "${nodeVersion}" ]; then
48- echo PATCH: replacing $serverNode with $nodePath
49- ln -sf $nodePath $serverNode
50 fi
0051 fi
5253 nodeVersion=$($serverNode -v)
54 echo "VS Code Node Version: $nodeVersion"
5556- if [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then
57- echo "Unsupported VS Code Node version: $nodeVersion", quitting
58 fail_with_exitcode ''${o.InstallExitCode.ServerTransferFailed}
59 fi
60···86 substituteInPlace "out/extension.js" \
87 --replace '# Start the server\n' '${patch}'
88 '';
008990 meta = {
91 description = "Use any remote machine with a SSH server as your development environment.";
···1{ lib
2+, nixosTests
3, vscode-utils
4, useLocalExtensions ? false
5}:
···910let
11 inherit (vscode-utils) buildVscodeMarketplaceExtension;
001213 # As VS Code executes this code on the remote machine
14 # we test to see if we can build Node from Nixpkgs
···22 serverNode="$serverDir/node"
23 echo "VS Code Node: $serverNode"
2425+ # Check if Node included with VS Code Server runs
26+ if ! nodeVersion=$($serverNode -v); then
27 echo "VS Code Node Version: $nodeVersion"
2829+ if ! nix-build "<nixpkgs>" -A patchelf --out-link "$serverDir/patchelf" || ! "$serverDir/patchelf/bin/patchelf" --version; then
30+ echo "Failed to get patchelf from nixpkgs"
31 fi
3233+ if [ -e $serverNode.orig ]; then
34+ cp $serverNode.orig $serverNode
35+ else
36+ cp $serverNode $serverNode.orig
37+ fi
3839+ if ! nix-build "<nixpkgs>" -A bintools --out-link $serverDir/bintools; then
40+ echo "Failed to build bintools from nixpkgs"
41+ fi
42+43+ INTERPRETER=$(cat $serverDir/bintools/nix-support/dynamic-linker)
44+45+ echo "Interpreter from bintools: $INTERPRETER"
4647+ if ! nix-build "<nixpkgs>" -A stdenv.cc.cc.lib --out-link $serverDir/cc; then
48+ echo "Failed to build stdenv.cc.cc.lib from nixpkgs"
000049 fi
5051+ if ! $serverDir/patchelf/bin/patchelf --set-interpreter $INTERPRETER --set-rpath $serverDir/cc-lib/lib $serverNode; then
52+ echo "Failed to patch Node binary"
053 fi
54+55+ rm "$serverDir/patchelf"
56 fi
5758 nodeVersion=$($serverNode -v)
59 echo "VS Code Node Version: $nodeVersion"
6061+ if ! nodeVersion=$($serverNode -v); then
62+ echo "Unable to fix Node binary, quitting"
63 fail_with_exitcode ''${o.InstallExitCode.ServerTransferFailed}
64 fi
65···91 substituteInPlace "out/extension.js" \
92 --replace '# Start the server\n' '${patch}'
93 '';
94+95+ passthru.tests = { inherit (nixosTests) vscode-remote-ssh; };
9697 meta = {
98 description = "Use any remote machine with a SSH server as your development environment.";
+4
pkgs/applications/editors/vscode/generic.nix
···13, version, src, meta, sourceRoot, commandLineArgs
14, executableName, longName, shortName, pname, updateScript
15, dontFixup ? false
0016# sourceExecutableName is the name of the binary in the source archive, over
17# which we have no control
18, sourceExecutableName ? executableName
···30 inherit executableName longName tests updateScript;
31 fhs = fhs {};
32 fhsWithPackages = f: fhs { additionalPkgs = f; };
0033 };
3435 desktopItem = makeDesktopItem {
···13, version, src, meta, sourceRoot, commandLineArgs
14, executableName, longName, shortName, pname, updateScript
15, dontFixup ? false
16+, rev ? null, vscodeServer ? null
17+18# sourceExecutableName is the name of the binary in the source archive, over
19# which we have no control
20, sourceExecutableName ? executableName
···32 inherit executableName longName tests updateScript;
33 fhs = fhs {};
34 fhsWithPackages = f: fhs { additionalPkgs = f; };
35+ } // lib.optionalAttrs (vscodeServer != null) {
36+ inherit rev vscodeServer;
37 };
3839 desktopItem = makeDesktopItem {
···1+{ stdenv
2+, lib
3+, callPackage
4+, fetchurl
5+, nixosTests
6+, srcOnly
7, isInsiders ? false
8, commandLineArgs ? ""
9, useVSCodeRipgrep ? stdenv.isDarwin
···37 version = "1.79.1";
38 pname = "vscode";
3940+ # This is used for VS Code - Remote SSH test
41+ rev = "b380da4ef1ee00e224a15c1d4d9793e27c2b6302";
42+43 executableName = "code" + lib.optionalString isInsiders "-insiders";
44 longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders";
45 shortName = "Code" + lib.optionalString isInsiders " - Insiders";
···5657 sourceRoot = "";
5859+ # As tests run without networking, we need to download this for the Remote SSH server
60+ vscodeServer = srcOnly {
61+ name = "vscode-server-${rev}.tar.gz";
62+ src = fetchurl {
63+ name = "vscode-server-${rev}.tar.gz";
64+ url = "https://update.code.visualstudio.com/commit:${rev}/server-linux-x64/stable";
65+ sha256 = "0732wpl4fjknhn423k23zrcqz9psjj1iy8lqa0fc8970n1m7i58b";
66+ };
67+ };
68+69+ tests = { inherit (nixosTests) vscode-remote-ssh; };
70+71 updateScript = ./update-vscode.sh;
7273 # Editing the `code` binary within the app bundle causes the bundle's signature
···91 homepage = "https://code.visualstudio.com/";
92 downloadPage = "https://code.visualstudio.com/Updates";
93 license = licenses.unfree;
94+ maintainers = with maintainers; [ eadwu synthetica maxeaubrey bobby285271 Enzime ];
95 platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" "armv7l-linux" ];
96 };
97 }
+1-2
pkgs/build-support/src-only/default.nix
···1{ stdenv }:
2# srcOnly is a utility builder that only fetches and unpacks the given `src`,
3-# maybe pathings it in the process with the optional `patches` and
4-# `buildInputs` attributes.
5#
6# It can be invoked directly, or be used to wrap an existing derivation. Eg:
7#
···1{ stdenv }:
2# srcOnly is a utility builder that only fetches and unpacks the given `src`,
3+# and optionally patching with `patches` or adding build inputs.
04#
5# It can be invoked directly, or be used to wrap an existing derivation. Eg:
6#