From e5005453d3315aa58a04b901cbecbef5e241f7b1 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Sat, 18 Mar 2023 15:54:49 -0300 Subject: vscode-extensions: refactor of extensions (#221878) * vscode-extensions: fix indentation for editorconfig * vscode-extensions.chenglou92.rescript-vscode: renamed directory * vscode-extensions.WakaTime.vscode-wakatime: rename directory * vscode-extensions.hashicorp.terraform: rename directory * vscode-extensions.ms-python.python: rename directory * vscode-extensions.sumneko.lua: rename directory * vscode-extensions.ms-vscode.cpptools: rename directory * vscode-extensions.ms-vscode-remote.remote-ssh: rename directory * vscode-extensions.rust-lang.rust-analyzer: rename directory * vscode-extensions.vadimcn.vscode-lldb: rename directory * vscode-extensions.ms-dotnettools.csharp: rename directory * vscode-extensions.ms-vsliveshare.vsliveshare: rename directory * vscode-extensions.ms-toolsai.jupyter: rename directory --- .../WakaTime.vscode-wakatime/default.nix | 22 + .../chenglou92.rescript-vscode/default.nix | 29 + .../rescript-editor-analysis.nix | 34 + .../editors/vscode/extensions/cpptools/default.nix | 90 - .../vscode/extensions/cpptools/missing_elf_deps.sh | 51 - .../cpptools/package-activation-events.json | 25 - .../vscode/extensions/cpptools/update_helper.sh | 165 - .../editors/vscode/extensions/default.nix | 30 +- .../extensions/hashicorp.terraform/default.nix | 20 + .../hashicorp.terraform/fix-terraform-ls.patch | 19 + .../editors/vscode/extensions/lua/default.nix | 27 - .../vscode/extensions/lua/remove-chmod.patch | 16 - .../extensions/ms-dotnettools-csharp/default.nix | 131 - .../extensions/ms-dotnettools.csharp/default.nix | 131 + .../vscode/extensions/ms-python.python/default.nix | 88 + .../extensions/ms-toolsai-jupyter/default.nix | 39 - .../extensions/ms-toolsai.jupyter/default.nix | 39 + .../ms-vscode-remote.remote-ssh/default.nix | 95 + .../extensions/ms-vscode.cpptools/default.nix | 90 + .../ms-vscode.cpptools/missing_elf_deps.sh | 51 + .../package-activation-events.json | 25 + .../extensions/ms-vscode.cpptools/update_helper.sh | 165 + .../ms-vsliveshare-vsliveshare/default.nix | 54 - .../ms-vsliveshare.vsliveshare/default.nix | 54 + .../editors/vscode/extensions/python/default.nix | 88 - .../vscode/extensions/remote-ssh/default.nix | 95 - .../editors/vscode/extensions/rescript/default.nix | 29 - .../rescript/rescript-editor-analysis.nix | 34 - .../rust-analyzer/build-deps/package.json | 23 - .../vscode/extensions/rust-analyzer/default.nix | 90 - .../vscode/extensions/rust-analyzer/update.sh | 51 - .../build-deps/package.json | 23 + .../extensions/rust-lang.rust-analyzer/default.nix | 90 + .../extensions/rust-lang.rust-analyzer/update.sh | 51 + .../vscode/extensions/sumneko.lua/default.nix | 27 + .../extensions/sumneko.lua/remove-chmod.patch | 16 + .../vscode/extensions/terraform/default.nix | 20 - .../extensions/terraform/fix-terraform-ls.patch | 19 - .../vadimcn.vscode-lldb/build-deps/default.nix | 17 + .../vadimcn.vscode-lldb/build-deps/node-env.nix | 598 ++++ .../build-deps/node-packages.nix | 3201 ++++++++++++++++++++ .../cmake-build-extension-only.patch | 52 + .../extensions/vadimcn.vscode-lldb/default.nix | 113 + .../fix-python-installation.patch | 13 + .../vscode/extensions/vadimcn.vscode-lldb/lldb.nix | 35 + .../extensions/vadimcn.vscode-lldb/update.sh | 45 + .../extensions/vscode-lldb/build-deps/default.nix | 17 - .../extensions/vscode-lldb/build-deps/node-env.nix | 598 ---- .../vscode-lldb/build-deps/node-packages.nix | 3201 -------------------- .../vscode-lldb/cmake-build-extension-only.patch | 52 - .../vscode/extensions/vscode-lldb/default.nix | 113 - .../vscode-lldb/fix-python-installation.patch | 13 - .../editors/vscode/extensions/vscode-lldb/lldb.nix | 35 - .../vscode/extensions/vscode-lldb/update.sh | 45 - .../editors/vscode/extensions/vscode-utils.nix | 4 +- .../editors/vscode/extensions/wakatime/default.nix | 22 - 56 files changed, 5160 insertions(+), 5160 deletions(-) create mode 100644 pkgs/applications/editors/vscode/extensions/WakaTime.vscode-wakatime/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/chenglou92.rescript-vscode/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/chenglou92.rescript-vscode/rescript-editor-analysis.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/cpptools/default.nix delete mode 100755 pkgs/applications/editors/vscode/extensions/cpptools/missing_elf_deps.sh delete mode 100644 pkgs/applications/editors/vscode/extensions/cpptools/package-activation-events.json delete mode 100755 pkgs/applications/editors/vscode/extensions/cpptools/update_helper.sh create mode 100644 pkgs/applications/editors/vscode/extensions/hashicorp.terraform/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/hashicorp.terraform/fix-terraform-ls.patch delete mode 100644 pkgs/applications/editors/vscode/extensions/lua/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/lua/remove-chmod.patch delete mode 100644 pkgs/applications/editors/vscode/extensions/ms-dotnettools-csharp/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/ms-dotnettools.csharp/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/ms-toolsai-jupyter/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/ms-toolsai.jupyter/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/ms-vscode-remote.remote-ssh/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/default.nix create mode 100755 pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/missing_elf_deps.sh create mode 100644 pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/package-activation-events.json create mode 100755 pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/update_helper.sh delete mode 100644 pkgs/applications/editors/vscode/extensions/ms-vsliveshare-vsliveshare/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/ms-vsliveshare.vsliveshare/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/python/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/remote-ssh/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/rescript/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/rescript/rescript-editor-analysis.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/rust-analyzer/build-deps/package.json delete mode 100644 pkgs/applications/editors/vscode/extensions/rust-analyzer/default.nix delete mode 100755 pkgs/applications/editors/vscode/extensions/rust-analyzer/update.sh create mode 100644 pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/build-deps/package.json create mode 100644 pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/default.nix create mode 100755 pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/update.sh create mode 100644 pkgs/applications/editors/vscode/extensions/sumneko.lua/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/sumneko.lua/remove-chmod.patch delete mode 100644 pkgs/applications/editors/vscode/extensions/terraform/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/terraform/fix-terraform-ls.patch create mode 100644 pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/node-env.nix create mode 100644 pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/node-packages.nix create mode 100644 pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/cmake-build-extension-only.patch create mode 100644 pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/default.nix create mode 100644 pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/fix-python-installation.patch create mode 100644 pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/lldb.nix create mode 100755 pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/update.sh delete mode 100644 pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/node-env.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/node-packages.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/vscode-lldb/cmake-build-extension-only.patch delete mode 100644 pkgs/applications/editors/vscode/extensions/vscode-lldb/default.nix delete mode 100644 pkgs/applications/editors/vscode/extensions/vscode-lldb/fix-python-installation.patch delete mode 100644 pkgs/applications/editors/vscode/extensions/vscode-lldb/lldb.nix delete mode 100755 pkgs/applications/editors/vscode/extensions/vscode-lldb/update.sh delete mode 100644 pkgs/applications/editors/vscode/extensions/wakatime/default.nix diff --git a/pkgs/applications/editors/vscode/extensions/WakaTime.vscode-wakatime/default.nix b/pkgs/applications/editors/vscode/extensions/WakaTime.vscode-wakatime/default.nix new file mode 100644 index 0000000000000..554b2bddb6cab --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/WakaTime.vscode-wakatime/default.nix @@ -0,0 +1,22 @@ +{ lib +, vscode-utils }: + +let + inherit (vscode-utils) buildVscodeMarketplaceExtension; +in + buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-wakatime"; + publisher = "WakaTime"; + version = "18.0.5"; + sha256 = "sha256-vWqGxMbxKqd4UgKK0sOKadMTDf6Y3TQxfWsc93MHjFs="; + }; + + meta = with lib; { + description = '' + Visual Studio Code plugin for automatic time tracking and metrics generated + from your programming activity + ''; + license = licenses.bsd3; + }; + } diff --git a/pkgs/applications/editors/vscode/extensions/chenglou92.rescript-vscode/default.nix b/pkgs/applications/editors/vscode/extensions/chenglou92.rescript-vscode/default.nix new file mode 100644 index 0000000000000..1f92e600f40fd --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/chenglou92.rescript-vscode/default.nix @@ -0,0 +1,29 @@ +{ lib, stdenv, vscode-utils, callPackage }: +let + version = "1.8.1"; + rescript-editor-analysis = callPackage ./rescript-editor-analysis.nix { inherit version; }; + arch = + if stdenv.isLinux then "linux" + else if stdenv.isDarwin then "darwin" + else throw "Unsupported platform"; + analysisDir = "server/analysis_binaries/${arch}"; +in +vscode-utils.buildVscodeMarketplaceExtension rec { + mktplcRef = { + name = "rescript-vscode"; + publisher = "chenglou92"; + inherit version; + sha256 = "sha256-XZG0PRzc3wyAVq9tQeGDlaUZg5YAgkPxJ3NsrdUHoOk="; + }; + postPatch = '' + rm -r ${analysisDir} + ln -s ${rescript-editor-analysis}/bin ${analysisDir} + ''; + + meta = with lib; { + description = "The official VSCode plugin for ReScript"; + homepage = "https://github.com/rescript-lang/rescript-vscode"; + maintainers = with maintainers; [ dlip jayesh-bhoot ]; + license = licenses.mit; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/chenglou92.rescript-vscode/rescript-editor-analysis.nix b/pkgs/applications/editors/vscode/extensions/chenglou92.rescript-vscode/rescript-editor-analysis.nix new file mode 100644 index 0000000000000..a87cd0943428e --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/chenglou92.rescript-vscode/rescript-editor-analysis.nix @@ -0,0 +1,34 @@ +{ lib, stdenv, fetchFromGitHub, bash, ocaml, dune_3, version }: + +stdenv.mkDerivation { + pname = "rescript-editor-analysis"; + inherit version; + + src = fetchFromGitHub { + owner = "rescript-lang"; + repo = "rescript-vscode"; + rev = version; + sha256 = "sha256-a8otK0BxZbl0nOp4QWQRkjb5fM85JA4nVkLuKAz71xU="; + }; + + nativeBuildInputs = [ ocaml dune_3 ]; + + # Skip testing phases because they need to download and install node modules + postPatch = '' + cd analysis + substituteInPlace Makefile \ + --replace "build: build-analysis-binary build-reanalyze build-tests" "build: build-analysis-binary" \ + --replace "test: test-analysis-binary test-reanalyze" "test: test-analysis-binary" + ''; + + installPhase = '' + install -D -m0555 rescript-editor-analysis.exe $out/bin/rescript-editor-analysis.exe + ''; + + meta = with lib; { + description = "Analysis binary for the ReScript VSCode plugin"; + homepage = "https://github.com/rescript-lang/rescript-vscode"; + maintainers = with maintainers; [ dlip jayesh-bhoot ]; + license = licenses.mit; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/cpptools/default.nix b/pkgs/applications/editors/vscode/extensions/cpptools/default.nix deleted file mode 100644 index 65f833a3fb74b..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/cpptools/default.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ lib, vscode-utils -, fetchurl, writeScript, runtimeShell -, jq, clang-tools -, gdbUseFixed ? true, gdb # The gdb default setting will be fixed to specified. Use version from `PATH` otherwise. -, autoPatchelfHook, makeWrapper, stdenv, lttng-ust, libkrb5, zlib -}: - -/* - Note that this version of the extension still has some nix specific issues - which could not be fixed merely by patching (inside a C# dll). - - In particular, the debugger requires either gnome-terminal or xterm. However - instead of looking for the terminal executable in `PATH`, for any linux platform - the dll uses an hardcoded path to one of these. - - So, in order for debugging to work properly, you merely need to create symlinks - to one of these terminals at the appropriate location. - - The good news is the the utility library is open source and with some effort - we could build a patched version ourselves. See: - - - - Also, the extension should eventually no longer require an external terminal. See: - - - - Once the symbolic link temporary solution taken, everything shoud run smootly. -*/ - -let - gdbDefaultsTo = if gdbUseFixed then "${gdb}/bin/gdb" else "gdb"; -in -vscode-utils.buildVscodeMarketplaceExtension rec { - mktplcRef = { - name = "cpptools"; - publisher = "ms-vscode"; - version = "1.11.0"; - sha256 = "c0725d3914aeb2515627691727455cc27e7a75031fa02ca957be02cc210bd64d"; - arch = "linux-x64"; - }; - - nativeBuildInputs = [ - autoPatchelfHook - makeWrapper - ]; - - buildInputs = [ - jq - lttng-ust - libkrb5 - zlib - stdenv.cc.cc.lib - ]; - - postPatch = '' - mv ./package.json ./package_orig.json - - # 1. Add activation events so that the extension is functional. This listing is empty when unpacking the extension but is filled at runtime. - # 2. Patch `package.json` so that nix's *gdb* is used as default value for `miDebuggerPath`. - cat ./package_orig.json | \ - jq --slurpfile actEvts ${./package-activation-events.json} '(.activationEvents) = $actEvts[0]' | \ - jq '(.contributes.debuggers[].configurationAttributes | .attach , .launch | .properties.miDebuggerPath | select(. != null) | select(.default == "/usr/bin/gdb") | .default) = "${gdbDefaultsTo}"' > \ - ./package.json - - # Prevent download/install of extensions - touch "./install.lock" - - # Clang-format from nix package. - mv ./LLVM/ ./LLVM_orig - mkdir "./LLVM/" - find "${clang-tools}" -mindepth 1 -maxdepth 1 | xargs ln -s -t "./LLVM" - - # Patching binaries - chmod +x bin/cpptools bin/cpptools-srv bin/cpptools-wordexp debugAdapters/bin/OpenDebugAD7 - patchelf --replace-needed liblttng-ust.so.0 liblttng-ust.so.1 ./debugAdapters/bin/libcoreclrtraceptprovider.so - ''; - - postFixup = lib.optionalString gdbUseFixed '' - wrapProgram $out/share/vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7 --prefix PATH : ${lib.makeBinPath [ gdb ]} - ''; - - meta = with lib; { - description = "The C/C++ extension adds language support for C/C++ to Visual Studio Code, including features such as IntelliSense and debugging."; - homepage = "https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools"; - license = licenses.unfree; - maintainers = with maintainers; [ jraygauthier stargate01 ]; - platforms = [ "x86_64-linux" ]; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/cpptools/missing_elf_deps.sh b/pkgs/applications/editors/vscode/extensions/cpptools/missing_elf_deps.sh deleted file mode 100755 index e282e126f83bc..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/cpptools/missing_elf_deps.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env nix-shell -#! nix-shell -p coreutils -i bash - -scriptDir=$(cd "`dirname "$0"`"; pwd) -echo "scriptDir='$scriptDir'" - -function get_pkg_out() { - local pkg="$1" - local suffix="${2:-}" - local nixExp="with (import {}); ${pkg}" - echo "$(nix-build -E "$nixExp" --no-out-link)${suffix}" -} - -interpreter="$(get_pkg_out "stdenv.cc.libc" "/lib/ld-linux-x86-64.so.2")" -echo "interpreter='$interpreter'" - -# For clangformat dep on 'libtinfo.so.5'. -ncursesLibDir="$(get_pkg_out "ncurses5.out" "/lib")" -echo "ncursesLibDir='$ncursesLibDir'" - -# For clanformat dep on 'libstdc++.so.6'. -stdcppLibDir="$(get_pkg_out "stdenv.cc.cc.lib" "/lib")" -echo "stdcppLibDir='$stdcppLibDir'" - -# For clangformat dep on 'libz.so.1'. -zlibLibDir="$(get_pkg_out "zlib.out" "/lib")" -echo "zlibLibDir='$zlibLibDir'" - -function patchelf_mono() { - local exe="$1" - patchelf --set-interpreter "$interpreter" "$exe" -} - -function patchelf_clangformat() { - local exe="$1" - patchelf --set-interpreter "$interpreter" "$exe" - local rpath="$ncursesLibDir:$stdcppLibDir:$zlibLibDir" - patchelf --set-rpath "$rpath" "$exe" -} - -function print_nix_version_clangtools() { - nixClangToolsBin="$(get_pkg_out "clang-tools" "/bin")" - echo "nixClangToolsBin='$nixClangToolsBin'" - $nixClangToolsBin/clang-format --version -} - -function print_nix_version_mono() { - nixMonoBin="$(get_pkg_out "mono" "/bin")" - echo "nixMonoBin='$nixMonoBin'" - $nixMonoBin/mono --version -} diff --git a/pkgs/applications/editors/vscode/extensions/cpptools/package-activation-events.json b/pkgs/applications/editors/vscode/extensions/cpptools/package-activation-events.json deleted file mode 100644 index c2d8a10f340a0..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/cpptools/package-activation-events.json +++ /dev/null @@ -1,25 +0,0 @@ -[ - "onLanguage:cpp", - "onLanguage:c", - "onCommand:extension.pickNativeProcess", - "onCommand:extension.pickRemoteNativeProcess", - "onCommand:C_Cpp.ConfigurationEdit", - "onCommand:C_Cpp.ConfigurationSelect", - "onCommand:C_Cpp.ConfigurationProviderSelect", - "onCommand:C_Cpp.SwitchHeaderSource", - "onCommand:C_Cpp.Navigate", - "onCommand:C_Cpp.GoToDeclaration", - "onCommand:C_Cpp.PeekDeclaration", - "onCommand:C_Cpp.ToggleErrorSquiggles", - "onCommand:C_Cpp.ToggleIncludeFallback", - "onCommand:C_Cpp.ToggleDimInactiveRegions", - "onCommand:C_Cpp.ToggleSnippets", - "onCommand:C_Cpp.ShowReleaseNotes", - "onCommand:C_Cpp.ResetDatabase", - "onCommand:C_Cpp.PauseParsing", - "onCommand:C_Cpp.ResumeParsing", - "onCommand:C_Cpp.ShowParsingCommands", - "onCommand:C_Cpp.TakeSurvey", - "onDebug", - "workspaceContains:/.vscode/c_cpp_properties.json" -] diff --git a/pkgs/applications/editors/vscode/extensions/cpptools/update_helper.sh b/pkgs/applications/editors/vscode/extensions/cpptools/update_helper.sh deleted file mode 100755 index d7bd307c92a01..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/cpptools/update_helper.sh +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env nix-shell -#! nix-shell -p coreutils -p jq -p unzip -i bash -set -euo pipefail - -# -# A little script to help maintaining this package. It will: -# -# - download the specified version of the extension to the store and print its url, packed store path and hash -# - unpack the extension, bring it to the store and print its store path and hash -# - fetch its runtimes dependencies from the 'package.json' file using the 'jq' utility, unpack those to the store -# and print its url store path and hash -# - patch elf of the binaries that got a nix replacement -# - bring the patched version to the store -# - run their '--version' and call 'ldd' -# - print the version of the runtime deps nix replacements. -# -# TODO: Print to a properly formated nix file all the required information to fetch everything (extension + runtime deps). -# TODO: Print x86 and maybe darwin runtime dependencies. -# - -scriptDir=$(cd "`dirname "$0"`"; pwd) -echo "scriptDir='$scriptDir'" - -extPublisher="vscode" -extName="cpptools" -defaultExtVersion="0.16.1" -extVersion="${1:-$defaultExtVersion}" - -echo -echo "------------- Downloading extension ---------------" - -extZipStoreName="${extPublisher}-${extName}.zip" -extUrl="https://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/ms-vscode/extension/cpptools/${extVersion}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage" -echo "extUrl='$extUrl'" -storePathWithSha=$(nix-prefetch-url --name "$extZipStoreName" --print-path "$extUrl" 2> /dev/null) - -cpptoolsZipStorePath="$(echo "$storePathWithSha" | tail -n1)" -cpptoolsZipSha256="$(echo "$storePathWithSha" | head -n1)" -echo "cpptoolsZipStorePath='$cpptoolsZipStorePath'" -echo "cpptoolsZipSha256='$cpptoolsZipSha256'" - - -extStoreName="${extPublisher}-${extName}" - - -function rm_tmpdir() { - rm -rf "$tmpDir" -} -function make_trapped_tmpdir() { - tmpDir=$(mktemp -d) - trap rm_tmpdir EXIT -} - -echo -echo "------------- Unpacked extension ---------------" - -make_trapped_tmpdir -unzip -q -d "$tmpDir" "$cpptoolsZipStorePath" - -cpptoolsStorePath="$(nix add-to-store -n "$extStoreName" "$tmpDir")" -cpptoolsSha256="$(nix hash-path --base32 --type sha512 "$cpptoolsStorePath")" -echo "cpptoolsStorePath='$cpptoolsStorePath'" -echo "cpptoolsSha256='$cpptoolsSha256'" - -rm_tmpdir - -storePathWithSha=$(nix-prefetch-url --print-path "file://${cpptoolsStorePath}/extension/package.json" 2> /dev/null) - -extPackageJSONStorePath="$(echo "$storePathWithSha" | tail -n1)" -extPackageJSONSha256="$(echo "$storePathWithSha" | head -n1)" -echo "extPackageJSONStorePath='$extPackageJSONStorePath'" -echo "extPackageJSONSha256='$extPackageJSONSha256'" - -print_runtime_dep() { - - local outName="$1" - local extPackageJSONStorePath="$2" - local depDesc="$3" - - local urlRaw=$(cat "$extPackageJSONStorePath" | jq -r --arg desc "$depDesc" '.runtimeDependencies[] | select(.description == $desc) | .url') - local url=$(echo $urlRaw | xargs curl -Ls -o /dev/null -w %{url_effective}) - - local urlRawVarStr="${outName}_urlRaw='$urlRaw'" - local urlVarStr="${outName}_url='$url'" - echo "$urlRawVarStr" - echo "$urlVarStr" - - local storePathWithSha="$(nix-prefetch-url --unpack --print-path "$url" 2> /dev/null)" - - local storePath="$(echo "$storePathWithSha" | tail -n1)" - local sha256="$(echo "$storePathWithSha" | head -n1)" - - local sha256VarStr="${outName}_sha256='$sha256'" - local storePathVarStr="${outName}_storePath='$storePath'" - echo "$sha256VarStr" - echo "$storePathVarStr" - - eval "$urlRawVarStr" - eval "$urlVarStr" - eval "$sha256VarStr" - eval "$storePathVarStr" -} - -echo -echo "------------- Runtime dependencies ---------------" - -print_runtime_dep "langComponentBinaries" "$extPackageJSONStorePath" "C/C++ language components (Linux / x86_64)" -print_runtime_dep "monoRuntimeBinaries" "$extPackageJSONStorePath" "Mono Runtime (Linux / x86_64)" -print_runtime_dep "clanFormatBinaries" "$extPackageJSONStorePath" "ClangFormat (Linux / x86_64)" - - -echo -echo "------------- Runtime deps missing elf deps ---------------" - -source "$scriptDir/missing_elf_deps.sh" - -echo -echo "------------- Runtime dep mono ---------------" - -make_trapped_tmpdir -find "$monoRuntimeBinaries_storePath" -mindepth 1 -maxdepth 1 | xargs -d '\n' cp -rp -t "$tmpDir" -chmod -R a+rwx "$tmpDir" - -ls -la "$tmpDir/debugAdapters" - -patchelf_mono "$tmpDir/debugAdapters/mono.linux-x86_64" - -chmod a+x "$tmpDir/debugAdapters/mono.linux-x86_64" -ldd "$tmpDir/debugAdapters/mono.linux-x86_64" -"$tmpDir/debugAdapters/mono.linux-x86_64" --version - -monoRuntimeBinariesPatched_storePath="$(nix add-to-store -n "monoRuntimeBinariesPatched" "$tmpDir")" -echo "monoRuntimeBinariesPatched_storePath='$monoRuntimeBinariesPatched_storePath'" - -rm_tmpdir - - -echo -echo "------------- Runtime dep clang ---------------" -make_trapped_tmpdir -find "$clanFormatBinaries_storePath" -mindepth 1 -maxdepth 1 | xargs -d '\n' cp -rp -t "$tmpDir" -chmod -R a+rwx "$tmpDir" - -ls -la "$tmpDir/bin" - -patchelf_clangformat "$tmpDir/bin/clang-format" - -chmod a+x "$tmpDir/bin/clang-format" -ldd "$tmpDir/bin/clang-format" -"$tmpDir/bin/clang-format" --version - - -clanFormatBinariesPatched_storePath="$(nix add-to-store -n "clanFormatBinariesPatched" "$tmpDir")" -echo "clanFormatBinariesPatched_storePath='$clanFormatBinariesPatched_storePath'" - -rm_tmpdir - -echo -echo "------------- Nix mono ---------------" -print_nix_version_clangtools - -echo -echo "------------- Nix mono ---------------" -print_nix_version_mono - diff --git a/pkgs/applications/editors/vscode/extensions/default.nix b/pkgs/applications/editors/vscode/extensions/default.nix index 82087a7d2c2e1..a888eb3695f4e 100644 --- a/pkgs/applications/editors/vscode/extensions/default.nix +++ b/pkgs/applications/editors/vscode/extensions/default.nix @@ -635,7 +635,7 @@ let }; }; - chenglou92.rescript-vscode = callPackage ./rescript { }; + chenglou92.rescript-vscode = callPackage ./chenglou92.rescript-vscode { }; christian-kohler.path-intellisense = buildVscodeMarketplaceExtension { mktplcRef = { @@ -1416,7 +1416,7 @@ let }; }; - hashicorp.terraform = callPackage ./terraform { }; + hashicorp.terraform = callPackage ./hashicorp.terraform { }; hookyqr.beautify = buildVscodeMarketplaceExtension { mktplcRef = { @@ -1930,7 +1930,7 @@ let ms-ceintl = callPackage ./language-packs.nix {}; # non-English language packs - ms-dotnettools.csharp = callPackage ./ms-dotnettools-csharp { }; + ms-dotnettools.csharp = callPackage ./ms-dotnettools.csharp { }; ms-kubernetes-tools.vscode-kubernetes-tools = buildVscodeMarketplaceExtension { mktplcRef = { @@ -1944,7 +1944,7 @@ let }; }; - ms-vscode.cpptools = callPackage ./cpptools { }; + ms-vscode.cpptools = callPackage ./ms-vscode.cpptools { }; ms-vscode.cmake-tools = buildVscodeMarketplaceExtension { mktplcRef = { @@ -1996,7 +1996,7 @@ let }; }; - ms-vscode-remote.remote-ssh = callPackage ./remote-ssh { }; + ms-vscode-remote.remote-ssh = callPackage ./ms-vscode-remote.remote-ssh { }; ms-vscode.theme-tomorrowkit = buildVscodeMarketplaceExtension { mktplcRef = { @@ -2031,7 +2031,7 @@ let }; }; - ms-python.python = callPackage ./python { }; + ms-python.python = callPackage ./ms-python.python { }; msjsdiag.debugger-for-chrome = buildVscodeMarketplaceExtension { mktplcRef = { @@ -2069,7 +2069,7 @@ let }; }; - ms-toolsai.jupyter = callPackage ./ms-toolsai-jupyter {}; + ms-toolsai.jupyter = callPackage ./ms-toolsai.jupyter {}; ms-toolsai.jupyter-keymap = buildVscodeMarketplaceExtension { mktplcRef = { @@ -2257,7 +2257,7 @@ let }; }; - rust-lang.rust-analyzer = callPackage ./rust-analyzer { }; + rust-lang.rust-analyzer = callPackage ./rust-lang.rust-analyzer { }; matklad.rust-analyzer = self.rust-lang.rust-analyzer; # Previous publisher ocamllabs.ocaml-platform = buildVscodeMarketplaceExtension { @@ -2648,7 +2648,7 @@ let }; }; - sumneko.lua = callPackage ./lua { }; + sumneko.lua = callPackage ./sumneko.lua { }; svelte.svelte-vscode = buildVscodeMarketplaceExtension { mktplcRef = { @@ -2858,7 +2858,7 @@ let }; }; - vadimcn.vscode-lldb = callPackage ./vscode-lldb { llvmPackages = llvmPackages_14; }; + vadimcn.vscode-lldb = callPackage ./vadimcn.vscode-lldb { llvmPackages = llvmPackages_14; }; valentjn.vscode-ltex = vscode-utils.buildVscodeMarketplaceExtension rec { mktplcRef = { @@ -2868,9 +2868,9 @@ let }; vsix = fetchurl { - name = "${mktplcRef.publisher}-${mktplcRef.name}.zip"; - url = "https://github.com/valentjn/vscode-ltex/releases/download/${mktplcRef.version}/vscode-ltex-${mktplcRef.version}-offline-linux-x64.vsix"; - sha256 = "1nlrijjwc35n1xgb5lgnr4yvlgfcxd0vdj93ip8lv2xi8x1ni5f6"; + name = "${mktplcRef.publisher}-${mktplcRef.name}.zip"; + url = "https://github.com/valentjn/vscode-ltex/releases/download/${mktplcRef.version}/vscode-ltex-${mktplcRef.version}-offline-linux-x64.vsix"; + sha256 = "1nlrijjwc35n1xgb5lgnr4yvlgfcxd0vdj93ip8lv2xi8x1ni5f6"; }; nativeBuildInputs = [ jq moreutils ]; @@ -2914,7 +2914,7 @@ let }; }; - ms-vsliveshare.vsliveshare = callPackage ./ms-vsliveshare-vsliveshare { }; + ms-vsliveshare.vsliveshare = callPackage ./ms-vsliveshare.vsliveshare { }; vscjava.vscode-java-debug = buildVscodeMarketplaceExtension { mktplcRef = { @@ -3119,7 +3119,7 @@ let }; }; - WakaTime.vscode-wakatime = callPackage ./wakatime { }; + WakaTime.vscode-wakatime = callPackage ./WakaTime.vscode-wakatime { }; wingrunr21.vscode-ruby = buildVscodeMarketplaceExtension { mktplcRef = { diff --git a/pkgs/applications/editors/vscode/extensions/hashicorp.terraform/default.nix b/pkgs/applications/editors/vscode/extensions/hashicorp.terraform/default.nix new file mode 100644 index 0000000000000..e6e094bb1cb6f --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/hashicorp.terraform/default.nix @@ -0,0 +1,20 @@ +{ lib, vscode-utils, terraform-ls }: +vscode-utils.buildVscodeMarketplaceExtension rec { + mktplcRef = { + name = "terraform"; + publisher = "hashicorp"; + version = "2.19.0"; + sha256 = "sha256-k/fcEJuELz0xkwivSrP6Nxtz861BLq1wR2ZDMXVrvkY="; + }; + + patches = [ ./fix-terraform-ls.patch ]; + + postPatch = '' + substituteInPlace out/serverPath.js --replace TERRAFORM-LS-PATH ${terraform-ls}/bin/terraform-ls + ''; + + meta = with lib; { + license = licenses.mit; + maintainers = with maintainers; [ rhoriguchi ]; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/hashicorp.terraform/fix-terraform-ls.patch b/pkgs/applications/editors/vscode/extensions/hashicorp.terraform/fix-terraform-ls.patch new file mode 100644 index 0000000000000..e2dcd0b70aa99 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/hashicorp.terraform/fix-terraform-ls.patch @@ -0,0 +1,19 @@ +diff --git a/out/serverPath.js b/out/serverPath.js +index fafa915..2e6d376 100644 +--- a/out/serverPath.js ++++ b/out/serverPath.js +@@ -18,7 +18,13 @@ exports.CUSTOM_BIN_PATH_OPTION_NAME = 'languageServer.pathToBinary'; + class ServerPath { + constructor(context) { + this.context = context; +- this.customBinPath = vscode.workspace.getConfiguration('terraform').get(exports.CUSTOM_BIN_PATH_OPTION_NAME); ++ ++ const customBinPath = vscode.workspace.getConfiguration('terraform').get(exports.CUSTOM_BIN_PATH_OPTION_NAME); ++ if (!customBinPath) { ++ this.customBinPath = 'TERRAFORM-LS-PATH'; ++ } else { ++ this.customBinPath = customBinPath; ++ } + } + installPath() { + return path.join(this.context.globalStorageUri.fsPath, INSTALL_FOLDER_NAME); diff --git a/pkgs/applications/editors/vscode/extensions/lua/default.nix b/pkgs/applications/editors/vscode/extensions/lua/default.nix deleted file mode 100644 index 6c9c72ca60942..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/lua/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ lib -, vscode-utils -, lua-language-server -}: - -vscode-utils.buildVscodeMarketplaceExtension { - mktplcRef = { - name = "lua"; - publisher = "sumneko"; - version = "3.5.6"; - sha256 = "sha256-Unzs9rX/0MlQprSvScdBCCFMeLCaGzWsMbcFqSKY2XY="; - }; - - patches = [ ./remove-chmod.patch ]; - - postInstall = '' - ln -sf ${lua-language-server}/bin/lua-language-server \ - $out/$installPrefix/server/bin/lua-language-server - ''; - - meta = with lib; { - description = "The Lua language server provides various language features for Lua to make development easier and faster."; - homepage = "https://marketplace.visualstudio.com/items?itemName=sumneko.lua"; - license = licenses.mit; - maintainers = with maintainers; [ lblasc ]; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/lua/remove-chmod.patch b/pkgs/applications/editors/vscode/extensions/lua/remove-chmod.patch deleted file mode 100644 index 8b9028625aa8e..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/lua/remove-chmod.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/client/out/languageserver.js b/client/out/languageserver.js -index 6c7429c..6f53aa4 100644 ---- a/client/out/languageserver.js -+++ b/client/out/languageserver.js -@@ -79,11 +79,9 @@ class LuaClient { - break; - case "linux": - command = this.context.asAbsolutePath(path.join('server', binDir ? binDir : 'bin-Linux', 'lua-language-server')); -- yield fs.promises.chmod(command, '777'); - break; - case "darwin": - command = this.context.asAbsolutePath(path.join('server', binDir ? binDir : 'bin-macOS', 'lua-language-server')); -- yield fs.promises.chmod(command, '777'); - break; - } - let serverOptions = { diff --git a/pkgs/applications/editors/vscode/extensions/ms-dotnettools-csharp/default.nix b/pkgs/applications/editors/vscode/extensions/ms-dotnettools-csharp/default.nix deleted file mode 100644 index 909dc69c02ed7..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/ms-dotnettools-csharp/default.nix +++ /dev/null @@ -1,131 +0,0 @@ -{ lib -, fetchurl -, vscode-utils -, patchelf -, icu -, stdenv -, openssl -}: -let - inherit (stdenv.hostPlatform) system; - - version = "1.25.0"; - - - vsixInfo = - let - linuxDebuggerBins = [ - ".debugger/vsdbg-ui" - ".debugger/vsdbg" - ]; - darwinX86DebuggerBins = [ - ".debugger/x86_64/vsdbg-ui" - ".debugger/x86_64/vsdbg" - ]; - darwinAarch64DebuggerBins = [ - ".debugger/arm64/vsdbg-ui" - ".debugger/arm64/vsdbg" - ]; - omniSharpBins = [ - ".omnisharp/1.39.0-net6.0/OmniSharp" - ]; - razorBins = [ - ".razor/createdump" - ".razor/rzls" - ]; - in - { - x86_64-linux = { - url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-linux-x64.vsix"; - sha256 = "1cqqjg8q6v56b19aabs9w1kxly457mpm0akbn5mis9nd1mrdmydl"; - binaries = linuxDebuggerBins ++ omniSharpBins ++ razorBins; - }; - aarch64-linux = { - url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-linux-arm64.vsix"; - sha256 = "0nsjgrb7y4w71w1gnrf50ifwbmjidi4vrw2fyfmch7lgjl8ilnhd"; - binaries = linuxDebuggerBins ++ omniSharpBins; # Linux aarch64 version has no Razor Language Server - }; - x86_64-darwin = { - url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-darwin-x64.vsix"; - sha256 = "01qn398vmjfi9imzlmzm0qi7y2h214wx6a8la088lfkhyj3gfjh8"; - binaries = darwinX86DebuggerBins ++ omniSharpBins ++ razorBins; - }; - aarch64-darwin = { - url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-darwin-arm64.vsix"; - sha256 = "020j451innh7jzarbv1ij57rfmqnlngdxaw6wdgp8sjkgbylr634"; - binaries = darwinAarch64DebuggerBins ++ darwinX86DebuggerBins ++ omniSharpBins ++ razorBins; - }; - }.${system} or (throw "Unsupported system: ${system}"); -in -vscode-utils.buildVscodeMarketplaceExtension rec { - mktplcRef = { - name = "csharp"; - publisher = "ms-dotnettools"; - inherit version; - }; - - vsix = fetchurl { - name = "${mktplcRef.publisher}-${mktplcRef.name}.zip"; - inherit (vsixInfo) url sha256; - }; - - nativeBuildInputs = [ - patchelf - ]; - - postPatch = '' - declare ext_unique_id - # See below as to why we cannot take the whole basename. - ext_unique_id="$(basename "$out" | head -c 32)" - - # Fix 'Unable to connect to debuggerEventsPipeName .. exceeds the maximum length 107.' when - # attempting to launch a specific test in debug mode. The extension attemps to open - # a pipe in extension dir which would fail anyway. We change to target file path - # to a path in tmp dir with a short name based on the unique part of the nix store path. - # This is however a brittle patch as we're working on minified code. - # Hence the attempt to only hold on stable names. - # However, this really would better be fixed upstream. - sed -i \ - -E -e 's/(this\._pipePath=[a-zA-Z0-9_]+\.join\()([a-zA-Z0-9_]+\.getExtensionPath\(\)[^,]*,)/\1require("os").tmpdir(), "'"$ext_unique_id"'"\+/g' \ - "$PWD/dist/extension.js" - - patchelf_add_icu_as_needed() { - declare elf="''${1?}" - declare icu_major_v="${ - lib.head (lib.splitVersion (lib.getVersion icu.name)) - }" - - for icu_lib in icui18n icuuc icudata; do - patchelf --add-needed "lib''${icu_lib}.so.$icu_major_v" "$elf" - done - } - - patchelf_common() { - declare elf="''${1?}" - - patchelf_add_icu_as_needed "$elf" - patchelf --add-needed "libssl.so" "$elf" - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc openssl icu.out ]}:\$ORIGIN" \ - "$elf" - } - - '' + (lib.concatStringsSep "\n" (map - (bin: '' - chmod +x "${bin}" - '') - vsixInfo.binaries)) - + lib.optionalString stdenv.isLinux (lib.concatStringsSep "\n" (map - (bin: '' - patchelf_common "${bin}" - '') - vsixInfo.binaries)); - - meta = with lib; { - description = "C# for Visual Studio Code (powered by OmniSharp)"; - homepage = "https://github.com/OmniSharp/omnisharp-vscode"; - license = licenses.mit; - maintainers = [ maintainers.jraygauthier ]; - platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/ms-dotnettools.csharp/default.nix b/pkgs/applications/editors/vscode/extensions/ms-dotnettools.csharp/default.nix new file mode 100644 index 0000000000000..909dc69c02ed7 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-dotnettools.csharp/default.nix @@ -0,0 +1,131 @@ +{ lib +, fetchurl +, vscode-utils +, patchelf +, icu +, stdenv +, openssl +}: +let + inherit (stdenv.hostPlatform) system; + + version = "1.25.0"; + + + vsixInfo = + let + linuxDebuggerBins = [ + ".debugger/vsdbg-ui" + ".debugger/vsdbg" + ]; + darwinX86DebuggerBins = [ + ".debugger/x86_64/vsdbg-ui" + ".debugger/x86_64/vsdbg" + ]; + darwinAarch64DebuggerBins = [ + ".debugger/arm64/vsdbg-ui" + ".debugger/arm64/vsdbg" + ]; + omniSharpBins = [ + ".omnisharp/1.39.0-net6.0/OmniSharp" + ]; + razorBins = [ + ".razor/createdump" + ".razor/rzls" + ]; + in + { + x86_64-linux = { + url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-linux-x64.vsix"; + sha256 = "1cqqjg8q6v56b19aabs9w1kxly457mpm0akbn5mis9nd1mrdmydl"; + binaries = linuxDebuggerBins ++ omniSharpBins ++ razorBins; + }; + aarch64-linux = { + url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-linux-arm64.vsix"; + sha256 = "0nsjgrb7y4w71w1gnrf50ifwbmjidi4vrw2fyfmch7lgjl8ilnhd"; + binaries = linuxDebuggerBins ++ omniSharpBins; # Linux aarch64 version has no Razor Language Server + }; + x86_64-darwin = { + url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-darwin-x64.vsix"; + sha256 = "01qn398vmjfi9imzlmzm0qi7y2h214wx6a8la088lfkhyj3gfjh8"; + binaries = darwinX86DebuggerBins ++ omniSharpBins ++ razorBins; + }; + aarch64-darwin = { + url = "https://github.com/OmniSharp/omnisharp-vscode/releases/download/v${version}/csharp-${version}-darwin-arm64.vsix"; + sha256 = "020j451innh7jzarbv1ij57rfmqnlngdxaw6wdgp8sjkgbylr634"; + binaries = darwinAarch64DebuggerBins ++ darwinX86DebuggerBins ++ omniSharpBins ++ razorBins; + }; + }.${system} or (throw "Unsupported system: ${system}"); +in +vscode-utils.buildVscodeMarketplaceExtension rec { + mktplcRef = { + name = "csharp"; + publisher = "ms-dotnettools"; + inherit version; + }; + + vsix = fetchurl { + name = "${mktplcRef.publisher}-${mktplcRef.name}.zip"; + inherit (vsixInfo) url sha256; + }; + + nativeBuildInputs = [ + patchelf + ]; + + postPatch = '' + declare ext_unique_id + # See below as to why we cannot take the whole basename. + ext_unique_id="$(basename "$out" | head -c 32)" + + # Fix 'Unable to connect to debuggerEventsPipeName .. exceeds the maximum length 107.' when + # attempting to launch a specific test in debug mode. The extension attemps to open + # a pipe in extension dir which would fail anyway. We change to target file path + # to a path in tmp dir with a short name based on the unique part of the nix store path. + # This is however a brittle patch as we're working on minified code. + # Hence the attempt to only hold on stable names. + # However, this really would better be fixed upstream. + sed -i \ + -E -e 's/(this\._pipePath=[a-zA-Z0-9_]+\.join\()([a-zA-Z0-9_]+\.getExtensionPath\(\)[^,]*,)/\1require("os").tmpdir(), "'"$ext_unique_id"'"\+/g' \ + "$PWD/dist/extension.js" + + patchelf_add_icu_as_needed() { + declare elf="''${1?}" + declare icu_major_v="${ + lib.head (lib.splitVersion (lib.getVersion icu.name)) + }" + + for icu_lib in icui18n icuuc icudata; do + patchelf --add-needed "lib''${icu_lib}.so.$icu_major_v" "$elf" + done + } + + patchelf_common() { + declare elf="''${1?}" + + patchelf_add_icu_as_needed "$elf" + patchelf --add-needed "libssl.so" "$elf" + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc openssl icu.out ]}:\$ORIGIN" \ + "$elf" + } + + '' + (lib.concatStringsSep "\n" (map + (bin: '' + chmod +x "${bin}" + '') + vsixInfo.binaries)) + + lib.optionalString stdenv.isLinux (lib.concatStringsSep "\n" (map + (bin: '' + patchelf_common "${bin}" + '') + vsixInfo.binaries)); + + meta = with lib; { + description = "C# for Visual Studio Code (powered by OmniSharp)"; + homepage = "https://github.com/OmniSharp/omnisharp-vscode"; + license = licenses.mit; + maintainers = [ maintainers.jraygauthier ]; + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix b/pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix new file mode 100644 index 0000000000000..0a62a5b02daad --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix @@ -0,0 +1,88 @@ +{ lib +, vscode-utils +, icu +, python3 + # When `true`, the python default setting will be fixed to specified. + # Use version from `PATH` for default setting otherwise. + # Defaults to `false` as we expect it to be project specific most of the time. +, pythonUseFixed ? false + # For updateScript +, writeScript +, bash +, curl +, coreutils +, gnused +, jq +, nix +}: + +vscode-utils.buildVscodeMarketplaceExtension rec { + mktplcRef = { + name = "python"; + publisher = "ms-python"; + version = "2023.1.10091012"; + sha256 = "sha256-JosFv6ngJmw1XRILwTZMVxlGIdWFLFQjj4olfnVwAIM="; + }; + + buildInputs = [ icu ]; + + nativeBuildInputs = [ python3.pkgs.wrapPython ]; + + propagatedBuildInputs = with python3.pkgs; [ + debugpy + jedi-language-server + ]; + + postPatch = '' + # remove bundled python deps and use libs from nixpkgs + rm -r pythonFiles/lib + mkdir -p pythonFiles/lib/python/ + ln -s ${python3.pkgs.debugpy}/lib/*/site-packages/debugpy pythonFiles/lib/python/ + buildPythonPath "$propagatedBuildInputs" + for i in pythonFiles/*.py; do + patchPythonScript "$i" + done + '' + lib.optionalString pythonUseFixed '' + # Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`. + substituteInPlace "./package.json" \ + --replace "\"default\": \"python\"" "\"default\": \"${python3.interpreter}\"" + ''; + + passthru.updateScript = writeScript "update" '' + #! ${bash}/bin/bash + + set -eu -o pipefail + + export PATH=${lib.makeBinPath [ + curl + coreutils + gnused + jq + nix + ]} + + api=$(curl -s 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \ + -H 'accept: application/json;api-version=3.0-preview.1' \ + -H 'content-type: application/json' \ + --data-raw '{"filters":[{"criteria":[{"filterType":7,"value":"${mktplcRef.publisher}.${mktplcRef.name}"}]}],"flags":16}') + # Find the latest version compatible with stable vscode version + version=$(echo $api | jq -r '.results[0].extensions[0].versions | map(select(has("properties"))) | map(select(.properties | map(select(.key == "Microsoft.VisualStudio.Code.Engine")) | .[0].value | test("\\^[0-9.]+$"))) | .[0].version') + + if [[ $version != ${mktplcRef.version} ]]; then + tmp=$(mktemp) + curl -sLo $tmp $(echo ${(import ../mktplcExtRefToFetchArgs.nix mktplcRef).url} | sed "s|${mktplcRef.version}|$version|") + hash=$(nix hash file --type sha256 --base32 --sri $tmp) + sed -i -e "s|${mktplcRef.sha256}|$hash|" -e "s|${mktplcRef.version}|$version|" pkgs/applications/editors/vscode/extensions/python/default.nix + fi + ''; + + meta = with lib; { + description = "A Visual Studio Code extension with rich support for the Python language"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=ms-python.python"; + homepage = "https://github.com/Microsoft/vscode-python"; + changelog = "https://github.com/microsoft/vscode-python/releases"; + license = licenses.mit; + platforms = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; + maintainers = with maintainers; [ jraygauthier jfchevrette ]; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/ms-toolsai-jupyter/default.nix b/pkgs/applications/editors/vscode/extensions/ms-toolsai-jupyter/default.nix deleted file mode 100644 index 7089f9e3d39dc..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/ms-toolsai-jupyter/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ lib, vscode-utils, jq, moreutils }: - -vscode-utils.buildVscodeMarketplaceExtension { - mktplcRef = { - name = "jupyter"; - publisher = "ms-toolsai"; - version = "2023.2.1000411022"; - sha256 = "sha256-gMK/t/rLXYN3rlHxxVeW0W/FWEP0ZCiEwzM8DY14vYg="; - }; - - nativeBuildInputs = [ - jq - moreutils - ]; - - postPatch = '' - # Patch 'packages.json' so that the expected '__metadata' field exists. - # This works around observed extension load failure on vscode's attempt - # to rewrite 'packages.json' with this new information. - print_jq_query() { - cat <<"EOF" - .__metadata = { - "id": "6c2f1801-1e7f-45b2-9b5c-7782f1e076e8", - "publisherId": "ac8eb7c9-3e59-4b39-8040-f0484d8170ce", - "publisherDisplayName": "Microsoft", - "installedTimestamp": 0 - } - EOF - } - jq "$(print_jq_query)" ./package.json | sponge ./package.json - ''; - - meta = with lib; { - description = "Jupyter extension for vscode"; - homepage = "https://github.com/microsoft/vscode-jupyter"; - license = licenses.mit; - maintainers = with maintainers; [ jraygauthier ]; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/ms-toolsai.jupyter/default.nix b/pkgs/applications/editors/vscode/extensions/ms-toolsai.jupyter/default.nix new file mode 100644 index 0000000000000..7089f9e3d39dc --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-toolsai.jupyter/default.nix @@ -0,0 +1,39 @@ +{ lib, vscode-utils, jq, moreutils }: + +vscode-utils.buildVscodeMarketplaceExtension { + mktplcRef = { + name = "jupyter"; + publisher = "ms-toolsai"; + version = "2023.2.1000411022"; + sha256 = "sha256-gMK/t/rLXYN3rlHxxVeW0W/FWEP0ZCiEwzM8DY14vYg="; + }; + + nativeBuildInputs = [ + jq + moreutils + ]; + + postPatch = '' + # Patch 'packages.json' so that the expected '__metadata' field exists. + # This works around observed extension load failure on vscode's attempt + # to rewrite 'packages.json' with this new information. + print_jq_query() { + cat <<"EOF" + .__metadata = { + "id": "6c2f1801-1e7f-45b2-9b5c-7782f1e076e8", + "publisherId": "ac8eb7c9-3e59-4b39-8040-f0484d8170ce", + "publisherDisplayName": "Microsoft", + "installedTimestamp": 0 + } + EOF + } + jq "$(print_jq_query)" ./package.json | sponge ./package.json + ''; + + meta = with lib; { + description = "Jupyter extension for vscode"; + homepage = "https://github.com/microsoft/vscode-jupyter"; + license = licenses.mit; + maintainers = with maintainers; [ jraygauthier ]; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/ms-vscode-remote.remote-ssh/default.nix b/pkgs/applications/editors/vscode/extensions/ms-vscode-remote.remote-ssh/default.nix new file mode 100644 index 0000000000000..ee2f8dbec9a62 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-vscode-remote.remote-ssh/default.nix @@ -0,0 +1,95 @@ +{ lib +, vscode-utils +, useLocalExtensions ? false +}: +# Note that useLocalExtensions requires that vscode-server is not running +# on host. If it is, you'll need to remove $HOME/.vscode-server, +# and redo the install by running "Connect to host" on client + +let + inherit (vscode-utils) buildVscodeMarketplaceExtension; + + nodeVersion = "16"; + + # As VS Code executes this code on the remote machine + # we test to see if we can build Node from Nixpkgs + # otherwise we check if the globally installed Node + # is usable. + patch = '' + # Use Node from nixpkgs for NixOS hosts + # + + serverDir="$HOME/.vscode-server/bin/$COMMIT_ID" + serverNode="$serverDir/node" + echo "VS Code Node: $serverNode" + + # Check if VS Code Server has a non-working Node or the wrong version of Node + if ! nodeVersion=$($serverNode -v) || [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then + echo "VS Code Node Version: $nodeVersion" + + if nix-build "" -A nodejs-${nodeVersion}_x --out-link "$serverDir/nix" && [ -e "$serverDir/nix/bin/node" ]; then + nodePath="$serverDir/nix/bin/node" + fi + + echo "Node from Nix: $nodePath" + + nodeVersion=$($nodePath -v) + echo "Node from Nix Version: $nodeVersion" + + if [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then + echo "Getting Node from Nix failed, use Local Node instead" + nodePath=$(which node) + echo "Local Node: $nodePath" + nodeVersion=$($nodePath -v) + echo "Local Node Version: $nodeVersion" + fi + + if [ "\''${nodeVersion:1:2}" == "${nodeVersion}" ]; then + echo PATCH: replacing $serverNode with $nodePath + ln -sf $nodePath $serverNode + fi + fi + + nodeVersion=$($serverNode -v) + echo "VS Code Node Version: $nodeVersion" + + if [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then + echo "Unsupported VS Code Node version: $nodeVersion", quitting + fail_with_exitcode ''${o.InstallExitCode.ServerTransferFailed} + fi + + ${lib.optionalString useLocalExtensions '' + # Use local extensions + if [ -d $HOME/.vscode/extensions ]; then + if [ -e $HOME/.vscode-server/extensions ]; then + mv $HOME/.vscode-server/extensions $HOME/.vscode-server/extensions.bak + fi + + mkdir -p $HOME/.vscode-server + ln -s $HOME/.vscode/extensions $HOME/.vscode-server/extensions + fi + ''} + + # + # Start the server + ''; +in +buildVscodeMarketplaceExtension { + mktplcRef = { + name = "remote-ssh"; + publisher = "ms-vscode-remote"; + version = "0.78.0"; + sha256 = "sha256-vd+9d86Z8429QpQVCZm8gtiJDcMpD++aiFVwvCrPg5w="; + }; + + postPatch = '' + substituteInPlace "out/extension.js" \ + --replace '# Start the server\n' '${patch}' + ''; + + meta = with lib; { + description = "Use any remote machine with a SSH server as your development environment."; + license = licenses.unfree; + maintainers = with maintainers; [ SuperSandro2000 tbenst ]; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/default.nix b/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/default.nix new file mode 100644 index 0000000000000..65f833a3fb74b --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/default.nix @@ -0,0 +1,90 @@ +{ lib, vscode-utils +, fetchurl, writeScript, runtimeShell +, jq, clang-tools +, gdbUseFixed ? true, gdb # The gdb default setting will be fixed to specified. Use version from `PATH` otherwise. +, autoPatchelfHook, makeWrapper, stdenv, lttng-ust, libkrb5, zlib +}: + +/* + Note that this version of the extension still has some nix specific issues + which could not be fixed merely by patching (inside a C# dll). + + In particular, the debugger requires either gnome-terminal or xterm. However + instead of looking for the terminal executable in `PATH`, for any linux platform + the dll uses an hardcoded path to one of these. + + So, in order for debugging to work properly, you merely need to create symlinks + to one of these terminals at the appropriate location. + + The good news is the the utility library is open source and with some effort + we could build a patched version ourselves. See: + + + + Also, the extension should eventually no longer require an external terminal. See: + + + + Once the symbolic link temporary solution taken, everything shoud run smootly. +*/ + +let + gdbDefaultsTo = if gdbUseFixed then "${gdb}/bin/gdb" else "gdb"; +in +vscode-utils.buildVscodeMarketplaceExtension rec { + mktplcRef = { + name = "cpptools"; + publisher = "ms-vscode"; + version = "1.11.0"; + sha256 = "c0725d3914aeb2515627691727455cc27e7a75031fa02ca957be02cc210bd64d"; + arch = "linux-x64"; + }; + + nativeBuildInputs = [ + autoPatchelfHook + makeWrapper + ]; + + buildInputs = [ + jq + lttng-ust + libkrb5 + zlib + stdenv.cc.cc.lib + ]; + + postPatch = '' + mv ./package.json ./package_orig.json + + # 1. Add activation events so that the extension is functional. This listing is empty when unpacking the extension but is filled at runtime. + # 2. Patch `package.json` so that nix's *gdb* is used as default value for `miDebuggerPath`. + cat ./package_orig.json | \ + jq --slurpfile actEvts ${./package-activation-events.json} '(.activationEvents) = $actEvts[0]' | \ + jq '(.contributes.debuggers[].configurationAttributes | .attach , .launch | .properties.miDebuggerPath | select(. != null) | select(.default == "/usr/bin/gdb") | .default) = "${gdbDefaultsTo}"' > \ + ./package.json + + # Prevent download/install of extensions + touch "./install.lock" + + # Clang-format from nix package. + mv ./LLVM/ ./LLVM_orig + mkdir "./LLVM/" + find "${clang-tools}" -mindepth 1 -maxdepth 1 | xargs ln -s -t "./LLVM" + + # Patching binaries + chmod +x bin/cpptools bin/cpptools-srv bin/cpptools-wordexp debugAdapters/bin/OpenDebugAD7 + patchelf --replace-needed liblttng-ust.so.0 liblttng-ust.so.1 ./debugAdapters/bin/libcoreclrtraceptprovider.so + ''; + + postFixup = lib.optionalString gdbUseFixed '' + wrapProgram $out/share/vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7 --prefix PATH : ${lib.makeBinPath [ gdb ]} + ''; + + meta = with lib; { + description = "The C/C++ extension adds language support for C/C++ to Visual Studio Code, including features such as IntelliSense and debugging."; + homepage = "https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools"; + license = licenses.unfree; + maintainers = with maintainers; [ jraygauthier stargate01 ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/missing_elf_deps.sh b/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/missing_elf_deps.sh new file mode 100755 index 0000000000000..e282e126f83bc --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/missing_elf_deps.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env nix-shell +#! nix-shell -p coreutils -i bash + +scriptDir=$(cd "`dirname "$0"`"; pwd) +echo "scriptDir='$scriptDir'" + +function get_pkg_out() { + local pkg="$1" + local suffix="${2:-}" + local nixExp="with (import {}); ${pkg}" + echo "$(nix-build -E "$nixExp" --no-out-link)${suffix}" +} + +interpreter="$(get_pkg_out "stdenv.cc.libc" "/lib/ld-linux-x86-64.so.2")" +echo "interpreter='$interpreter'" + +# For clangformat dep on 'libtinfo.so.5'. +ncursesLibDir="$(get_pkg_out "ncurses5.out" "/lib")" +echo "ncursesLibDir='$ncursesLibDir'" + +# For clanformat dep on 'libstdc++.so.6'. +stdcppLibDir="$(get_pkg_out "stdenv.cc.cc.lib" "/lib")" +echo "stdcppLibDir='$stdcppLibDir'" + +# For clangformat dep on 'libz.so.1'. +zlibLibDir="$(get_pkg_out "zlib.out" "/lib")" +echo "zlibLibDir='$zlibLibDir'" + +function patchelf_mono() { + local exe="$1" + patchelf --set-interpreter "$interpreter" "$exe" +} + +function patchelf_clangformat() { + local exe="$1" + patchelf --set-interpreter "$interpreter" "$exe" + local rpath="$ncursesLibDir:$stdcppLibDir:$zlibLibDir" + patchelf --set-rpath "$rpath" "$exe" +} + +function print_nix_version_clangtools() { + nixClangToolsBin="$(get_pkg_out "clang-tools" "/bin")" + echo "nixClangToolsBin='$nixClangToolsBin'" + $nixClangToolsBin/clang-format --version +} + +function print_nix_version_mono() { + nixMonoBin="$(get_pkg_out "mono" "/bin")" + echo "nixMonoBin='$nixMonoBin'" + $nixMonoBin/mono --version +} diff --git a/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/package-activation-events.json b/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/package-activation-events.json new file mode 100644 index 0000000000000..c2d8a10f340a0 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/package-activation-events.json @@ -0,0 +1,25 @@ +[ + "onLanguage:cpp", + "onLanguage:c", + "onCommand:extension.pickNativeProcess", + "onCommand:extension.pickRemoteNativeProcess", + "onCommand:C_Cpp.ConfigurationEdit", + "onCommand:C_Cpp.ConfigurationSelect", + "onCommand:C_Cpp.ConfigurationProviderSelect", + "onCommand:C_Cpp.SwitchHeaderSource", + "onCommand:C_Cpp.Navigate", + "onCommand:C_Cpp.GoToDeclaration", + "onCommand:C_Cpp.PeekDeclaration", + "onCommand:C_Cpp.ToggleErrorSquiggles", + "onCommand:C_Cpp.ToggleIncludeFallback", + "onCommand:C_Cpp.ToggleDimInactiveRegions", + "onCommand:C_Cpp.ToggleSnippets", + "onCommand:C_Cpp.ShowReleaseNotes", + "onCommand:C_Cpp.ResetDatabase", + "onCommand:C_Cpp.PauseParsing", + "onCommand:C_Cpp.ResumeParsing", + "onCommand:C_Cpp.ShowParsingCommands", + "onCommand:C_Cpp.TakeSurvey", + "onDebug", + "workspaceContains:/.vscode/c_cpp_properties.json" +] diff --git a/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/update_helper.sh b/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/update_helper.sh new file mode 100755 index 0000000000000..d7bd307c92a01 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-vscode.cpptools/update_helper.sh @@ -0,0 +1,165 @@ +#!/usr/bin/env nix-shell +#! nix-shell -p coreutils -p jq -p unzip -i bash +set -euo pipefail + +# +# A little script to help maintaining this package. It will: +# +# - download the specified version of the extension to the store and print its url, packed store path and hash +# - unpack the extension, bring it to the store and print its store path and hash +# - fetch its runtimes dependencies from the 'package.json' file using the 'jq' utility, unpack those to the store +# and print its url store path and hash +# - patch elf of the binaries that got a nix replacement +# - bring the patched version to the store +# - run their '--version' and call 'ldd' +# - print the version of the runtime deps nix replacements. +# +# TODO: Print to a properly formated nix file all the required information to fetch everything (extension + runtime deps). +# TODO: Print x86 and maybe darwin runtime dependencies. +# + +scriptDir=$(cd "`dirname "$0"`"; pwd) +echo "scriptDir='$scriptDir'" + +extPublisher="vscode" +extName="cpptools" +defaultExtVersion="0.16.1" +extVersion="${1:-$defaultExtVersion}" + +echo +echo "------------- Downloading extension ---------------" + +extZipStoreName="${extPublisher}-${extName}.zip" +extUrl="https://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/ms-vscode/extension/cpptools/${extVersion}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage" +echo "extUrl='$extUrl'" +storePathWithSha=$(nix-prefetch-url --name "$extZipStoreName" --print-path "$extUrl" 2> /dev/null) + +cpptoolsZipStorePath="$(echo "$storePathWithSha" | tail -n1)" +cpptoolsZipSha256="$(echo "$storePathWithSha" | head -n1)" +echo "cpptoolsZipStorePath='$cpptoolsZipStorePath'" +echo "cpptoolsZipSha256='$cpptoolsZipSha256'" + + +extStoreName="${extPublisher}-${extName}" + + +function rm_tmpdir() { + rm -rf "$tmpDir" +} +function make_trapped_tmpdir() { + tmpDir=$(mktemp -d) + trap rm_tmpdir EXIT +} + +echo +echo "------------- Unpacked extension ---------------" + +make_trapped_tmpdir +unzip -q -d "$tmpDir" "$cpptoolsZipStorePath" + +cpptoolsStorePath="$(nix add-to-store -n "$extStoreName" "$tmpDir")" +cpptoolsSha256="$(nix hash-path --base32 --type sha512 "$cpptoolsStorePath")" +echo "cpptoolsStorePath='$cpptoolsStorePath'" +echo "cpptoolsSha256='$cpptoolsSha256'" + +rm_tmpdir + +storePathWithSha=$(nix-prefetch-url --print-path "file://${cpptoolsStorePath}/extension/package.json" 2> /dev/null) + +extPackageJSONStorePath="$(echo "$storePathWithSha" | tail -n1)" +extPackageJSONSha256="$(echo "$storePathWithSha" | head -n1)" +echo "extPackageJSONStorePath='$extPackageJSONStorePath'" +echo "extPackageJSONSha256='$extPackageJSONSha256'" + +print_runtime_dep() { + + local outName="$1" + local extPackageJSONStorePath="$2" + local depDesc="$3" + + local urlRaw=$(cat "$extPackageJSONStorePath" | jq -r --arg desc "$depDesc" '.runtimeDependencies[] | select(.description == $desc) | .url') + local url=$(echo $urlRaw | xargs curl -Ls -o /dev/null -w %{url_effective}) + + local urlRawVarStr="${outName}_urlRaw='$urlRaw'" + local urlVarStr="${outName}_url='$url'" + echo "$urlRawVarStr" + echo "$urlVarStr" + + local storePathWithSha="$(nix-prefetch-url --unpack --print-path "$url" 2> /dev/null)" + + local storePath="$(echo "$storePathWithSha" | tail -n1)" + local sha256="$(echo "$storePathWithSha" | head -n1)" + + local sha256VarStr="${outName}_sha256='$sha256'" + local storePathVarStr="${outName}_storePath='$storePath'" + echo "$sha256VarStr" + echo "$storePathVarStr" + + eval "$urlRawVarStr" + eval "$urlVarStr" + eval "$sha256VarStr" + eval "$storePathVarStr" +} + +echo +echo "------------- Runtime dependencies ---------------" + +print_runtime_dep "langComponentBinaries" "$extPackageJSONStorePath" "C/C++ language components (Linux / x86_64)" +print_runtime_dep "monoRuntimeBinaries" "$extPackageJSONStorePath" "Mono Runtime (Linux / x86_64)" +print_runtime_dep "clanFormatBinaries" "$extPackageJSONStorePath" "ClangFormat (Linux / x86_64)" + + +echo +echo "------------- Runtime deps missing elf deps ---------------" + +source "$scriptDir/missing_elf_deps.sh" + +echo +echo "------------- Runtime dep mono ---------------" + +make_trapped_tmpdir +find "$monoRuntimeBinaries_storePath" -mindepth 1 -maxdepth 1 | xargs -d '\n' cp -rp -t "$tmpDir" +chmod -R a+rwx "$tmpDir" + +ls -la "$tmpDir/debugAdapters" + +patchelf_mono "$tmpDir/debugAdapters/mono.linux-x86_64" + +chmod a+x "$tmpDir/debugAdapters/mono.linux-x86_64" +ldd "$tmpDir/debugAdapters/mono.linux-x86_64" +"$tmpDir/debugAdapters/mono.linux-x86_64" --version + +monoRuntimeBinariesPatched_storePath="$(nix add-to-store -n "monoRuntimeBinariesPatched" "$tmpDir")" +echo "monoRuntimeBinariesPatched_storePath='$monoRuntimeBinariesPatched_storePath'" + +rm_tmpdir + + +echo +echo "------------- Runtime dep clang ---------------" +make_trapped_tmpdir +find "$clanFormatBinaries_storePath" -mindepth 1 -maxdepth 1 | xargs -d '\n' cp -rp -t "$tmpDir" +chmod -R a+rwx "$tmpDir" + +ls -la "$tmpDir/bin" + +patchelf_clangformat "$tmpDir/bin/clang-format" + +chmod a+x "$tmpDir/bin/clang-format" +ldd "$tmpDir/bin/clang-format" +"$tmpDir/bin/clang-format" --version + + +clanFormatBinariesPatched_storePath="$(nix add-to-store -n "clanFormatBinariesPatched" "$tmpDir")" +echo "clanFormatBinariesPatched_storePath='$clanFormatBinariesPatched_storePath'" + +rm_tmpdir + +echo +echo "------------- Nix mono ---------------" +print_nix_version_clangtools + +echo +echo "------------- Nix mono ---------------" +print_nix_version_mono + diff --git a/pkgs/applications/editors/vscode/extensions/ms-vsliveshare-vsliveshare/default.nix b/pkgs/applications/editors/vscode/extensions/ms-vsliveshare-vsliveshare/default.nix deleted file mode 100644 index 3c20aa299b6ef..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/ms-vsliveshare-vsliveshare/default.nix +++ /dev/null @@ -1,54 +0,0 @@ -# Based on previous attempts: -# - -# - -{ lib, gccStdenv, vscode-utils -, autoPatchelfHook, bash, makeWrapper -, curl, gcc, libsecret, libunwind, libX11, lttng-ust, util-linux -, desktop-file-utils, xsel -}: - -let - # https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#install-prerequisites-manually - libs = [ - # Credential Storage - libsecret - - # NodeJS - libX11 - - # https://github.com/flathub/com.visualstudio.code.oss/issues/11#issuecomment-392709170 - libunwind - lttng-ust - curl - - # General - gcc.cc.lib - util-linux # libuuid - ]; - -in ((vscode-utils.override { stdenv = gccStdenv; }).buildVscodeMarketplaceExtension { - mktplcRef = { - name = "vsliveshare"; - publisher = "ms-vsliveshare"; - version = "1.0.5834"; - sha256 = "sha256-+KfivY8W1VtUxhdXuUKI5e1elo6Ert1Tsf4xVXsKB3Y="; - }; -}).overrideAttrs({ buildInputs ? [], ... }: { - buildInputs = buildInputs ++ libs; - - # Using a patch file won't work, because the file changes too often, causing the patch to fail on most updates. - # Rather than patching the calls to functions, we modify the functions to return what we want, - # which is less likely to break in the future. - postPatch = '' - substituteInPlace extension.js \ - --replace "'xsel'" "'${xsel}/bin/xsel'" - ''; - - meta = with lib; { - description = "Live Share lets you achieve greater confidence at speed by streamlining collaborative editing, debugging, and more in real-time during development"; - homepage = "https://aka.ms/vsls-docs"; - license = licenses.unfree; - maintainers = with maintainers; [ jraygauthier V ]; - platforms = [ "x86_64-linux" ]; - }; -}) diff --git a/pkgs/applications/editors/vscode/extensions/ms-vsliveshare.vsliveshare/default.nix b/pkgs/applications/editors/vscode/extensions/ms-vsliveshare.vsliveshare/default.nix new file mode 100644 index 0000000000000..3c20aa299b6ef --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/ms-vsliveshare.vsliveshare/default.nix @@ -0,0 +1,54 @@ +# Based on previous attempts: +# - +# - +{ lib, gccStdenv, vscode-utils +, autoPatchelfHook, bash, makeWrapper +, curl, gcc, libsecret, libunwind, libX11, lttng-ust, util-linux +, desktop-file-utils, xsel +}: + +let + # https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#install-prerequisites-manually + libs = [ + # Credential Storage + libsecret + + # NodeJS + libX11 + + # https://github.com/flathub/com.visualstudio.code.oss/issues/11#issuecomment-392709170 + libunwind + lttng-ust + curl + + # General + gcc.cc.lib + util-linux # libuuid + ]; + +in ((vscode-utils.override { stdenv = gccStdenv; }).buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vsliveshare"; + publisher = "ms-vsliveshare"; + version = "1.0.5834"; + sha256 = "sha256-+KfivY8W1VtUxhdXuUKI5e1elo6Ert1Tsf4xVXsKB3Y="; + }; +}).overrideAttrs({ buildInputs ? [], ... }: { + buildInputs = buildInputs ++ libs; + + # Using a patch file won't work, because the file changes too often, causing the patch to fail on most updates. + # Rather than patching the calls to functions, we modify the functions to return what we want, + # which is less likely to break in the future. + postPatch = '' + substituteInPlace extension.js \ + --replace "'xsel'" "'${xsel}/bin/xsel'" + ''; + + meta = with lib; { + description = "Live Share lets you achieve greater confidence at speed by streamlining collaborative editing, debugging, and more in real-time during development"; + homepage = "https://aka.ms/vsls-docs"; + license = licenses.unfree; + maintainers = with maintainers; [ jraygauthier V ]; + platforms = [ "x86_64-linux" ]; + }; +}) diff --git a/pkgs/applications/editors/vscode/extensions/python/default.nix b/pkgs/applications/editors/vscode/extensions/python/default.nix deleted file mode 100644 index 0a62a5b02daad..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/python/default.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ lib -, vscode-utils -, icu -, python3 - # When `true`, the python default setting will be fixed to specified. - # Use version from `PATH` for default setting otherwise. - # Defaults to `false` as we expect it to be project specific most of the time. -, pythonUseFixed ? false - # For updateScript -, writeScript -, bash -, curl -, coreutils -, gnused -, jq -, nix -}: - -vscode-utils.buildVscodeMarketplaceExtension rec { - mktplcRef = { - name = "python"; - publisher = "ms-python"; - version = "2023.1.10091012"; - sha256 = "sha256-JosFv6ngJmw1XRILwTZMVxlGIdWFLFQjj4olfnVwAIM="; - }; - - buildInputs = [ icu ]; - - nativeBuildInputs = [ python3.pkgs.wrapPython ]; - - propagatedBuildInputs = with python3.pkgs; [ - debugpy - jedi-language-server - ]; - - postPatch = '' - # remove bundled python deps and use libs from nixpkgs - rm -r pythonFiles/lib - mkdir -p pythonFiles/lib/python/ - ln -s ${python3.pkgs.debugpy}/lib/*/site-packages/debugpy pythonFiles/lib/python/ - buildPythonPath "$propagatedBuildInputs" - for i in pythonFiles/*.py; do - patchPythonScript "$i" - done - '' + lib.optionalString pythonUseFixed '' - # Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`. - substituteInPlace "./package.json" \ - --replace "\"default\": \"python\"" "\"default\": \"${python3.interpreter}\"" - ''; - - passthru.updateScript = writeScript "update" '' - #! ${bash}/bin/bash - - set -eu -o pipefail - - export PATH=${lib.makeBinPath [ - curl - coreutils - gnused - jq - nix - ]} - - api=$(curl -s 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \ - -H 'accept: application/json;api-version=3.0-preview.1' \ - -H 'content-type: application/json' \ - --data-raw '{"filters":[{"criteria":[{"filterType":7,"value":"${mktplcRef.publisher}.${mktplcRef.name}"}]}],"flags":16}') - # Find the latest version compatible with stable vscode version - version=$(echo $api | jq -r '.results[0].extensions[0].versions | map(select(has("properties"))) | map(select(.properties | map(select(.key == "Microsoft.VisualStudio.Code.Engine")) | .[0].value | test("\\^[0-9.]+$"))) | .[0].version') - - if [[ $version != ${mktplcRef.version} ]]; then - tmp=$(mktemp) - curl -sLo $tmp $(echo ${(import ../mktplcExtRefToFetchArgs.nix mktplcRef).url} | sed "s|${mktplcRef.version}|$version|") - hash=$(nix hash file --type sha256 --base32 --sri $tmp) - sed -i -e "s|${mktplcRef.sha256}|$hash|" -e "s|${mktplcRef.version}|$version|" pkgs/applications/editors/vscode/extensions/python/default.nix - fi - ''; - - meta = with lib; { - description = "A Visual Studio Code extension with rich support for the Python language"; - downloadPage = "https://marketplace.visualstudio.com/items?itemName=ms-python.python"; - homepage = "https://github.com/Microsoft/vscode-python"; - changelog = "https://github.com/microsoft/vscode-python/releases"; - license = licenses.mit; - platforms = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; - maintainers = with maintainers; [ jraygauthier jfchevrette ]; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/remote-ssh/default.nix b/pkgs/applications/editors/vscode/extensions/remote-ssh/default.nix deleted file mode 100644 index ee2f8dbec9a62..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/remote-ssh/default.nix +++ /dev/null @@ -1,95 +0,0 @@ -{ lib -, vscode-utils -, useLocalExtensions ? false -}: -# Note that useLocalExtensions requires that vscode-server is not running -# on host. If it is, you'll need to remove $HOME/.vscode-server, -# and redo the install by running "Connect to host" on client - -let - inherit (vscode-utils) buildVscodeMarketplaceExtension; - - nodeVersion = "16"; - - # As VS Code executes this code on the remote machine - # we test to see if we can build Node from Nixpkgs - # otherwise we check if the globally installed Node - # is usable. - patch = '' - # Use Node from nixpkgs for NixOS hosts - # - - serverDir="$HOME/.vscode-server/bin/$COMMIT_ID" - serverNode="$serverDir/node" - echo "VS Code Node: $serverNode" - - # Check if VS Code Server has a non-working Node or the wrong version of Node - if ! nodeVersion=$($serverNode -v) || [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then - echo "VS Code Node Version: $nodeVersion" - - if nix-build "" -A nodejs-${nodeVersion}_x --out-link "$serverDir/nix" && [ -e "$serverDir/nix/bin/node" ]; then - nodePath="$serverDir/nix/bin/node" - fi - - echo "Node from Nix: $nodePath" - - nodeVersion=$($nodePath -v) - echo "Node from Nix Version: $nodeVersion" - - if [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then - echo "Getting Node from Nix failed, use Local Node instead" - nodePath=$(which node) - echo "Local Node: $nodePath" - nodeVersion=$($nodePath -v) - echo "Local Node Version: $nodeVersion" - fi - - if [ "\''${nodeVersion:1:2}" == "${nodeVersion}" ]; then - echo PATCH: replacing $serverNode with $nodePath - ln -sf $nodePath $serverNode - fi - fi - - nodeVersion=$($serverNode -v) - echo "VS Code Node Version: $nodeVersion" - - if [ "\''${nodeVersion:1:2}" != "${nodeVersion}" ]; then - echo "Unsupported VS Code Node version: $nodeVersion", quitting - fail_with_exitcode ''${o.InstallExitCode.ServerTransferFailed} - fi - - ${lib.optionalString useLocalExtensions '' - # Use local extensions - if [ -d $HOME/.vscode/extensions ]; then - if [ -e $HOME/.vscode-server/extensions ]; then - mv $HOME/.vscode-server/extensions $HOME/.vscode-server/extensions.bak - fi - - mkdir -p $HOME/.vscode-server - ln -s $HOME/.vscode/extensions $HOME/.vscode-server/extensions - fi - ''} - - # - # Start the server - ''; -in -buildVscodeMarketplaceExtension { - mktplcRef = { - name = "remote-ssh"; - publisher = "ms-vscode-remote"; - version = "0.78.0"; - sha256 = "sha256-vd+9d86Z8429QpQVCZm8gtiJDcMpD++aiFVwvCrPg5w="; - }; - - postPatch = '' - substituteInPlace "out/extension.js" \ - --replace '# Start the server\n' '${patch}' - ''; - - meta = with lib; { - description = "Use any remote machine with a SSH server as your development environment."; - license = licenses.unfree; - maintainers = with maintainers; [ SuperSandro2000 tbenst ]; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/rescript/default.nix b/pkgs/applications/editors/vscode/extensions/rescript/default.nix deleted file mode 100644 index 1f92e600f40fd..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/rescript/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ lib, stdenv, vscode-utils, callPackage }: -let - version = "1.8.1"; - rescript-editor-analysis = callPackage ./rescript-editor-analysis.nix { inherit version; }; - arch = - if stdenv.isLinux then "linux" - else if stdenv.isDarwin then "darwin" - else throw "Unsupported platform"; - analysisDir = "server/analysis_binaries/${arch}"; -in -vscode-utils.buildVscodeMarketplaceExtension rec { - mktplcRef = { - name = "rescript-vscode"; - publisher = "chenglou92"; - inherit version; - sha256 = "sha256-XZG0PRzc3wyAVq9tQeGDlaUZg5YAgkPxJ3NsrdUHoOk="; - }; - postPatch = '' - rm -r ${analysisDir} - ln -s ${rescript-editor-analysis}/bin ${analysisDir} - ''; - - meta = with lib; { - description = "The official VSCode plugin for ReScript"; - homepage = "https://github.com/rescript-lang/rescript-vscode"; - maintainers = with maintainers; [ dlip jayesh-bhoot ]; - license = licenses.mit; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/rescript/rescript-editor-analysis.nix b/pkgs/applications/editors/vscode/extensions/rescript/rescript-editor-analysis.nix deleted file mode 100644 index a87cd0943428e..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/rescript/rescript-editor-analysis.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib, stdenv, fetchFromGitHub, bash, ocaml, dune_3, version }: - -stdenv.mkDerivation { - pname = "rescript-editor-analysis"; - inherit version; - - src = fetchFromGitHub { - owner = "rescript-lang"; - repo = "rescript-vscode"; - rev = version; - sha256 = "sha256-a8otK0BxZbl0nOp4QWQRkjb5fM85JA4nVkLuKAz71xU="; - }; - - nativeBuildInputs = [ ocaml dune_3 ]; - - # Skip testing phases because they need to download and install node modules - postPatch = '' - cd analysis - substituteInPlace Makefile \ - --replace "build: build-analysis-binary build-reanalyze build-tests" "build: build-analysis-binary" \ - --replace "test: test-analysis-binary test-reanalyze" "test: test-analysis-binary" - ''; - - installPhase = '' - install -D -m0555 rescript-editor-analysis.exe $out/bin/rescript-editor-analysis.exe - ''; - - meta = with lib; { - description = "Analysis binary for the ReScript VSCode plugin"; - homepage = "https://github.com/rescript-lang/rescript-vscode"; - maintainers = with maintainers; [ dlip jayesh-bhoot ]; - license = licenses.mit; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/rust-analyzer/build-deps/package.json b/pkgs/applications/editors/vscode/extensions/rust-analyzer/build-deps/package.json deleted file mode 100644 index 167f92fbede95..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/rust-analyzer/build-deps/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "rust-analyzer", - "version": "0.3.1426", - "dependencies": { - "anser": "^2.1.1", - "d3": "^7.6.1", - "d3-graphviz": "^5.0.2", - "vscode-languageclient": "^8.0.2", - "@types/node": "~16.11.7", - "@types/vscode": "~1.66.0", - "@typescript-eslint/eslint-plugin": "^5.30.5", - "@typescript-eslint/parser": "^5.30.5", - "@vscode/test-electron": "^2.1.5", - "cross-env": "^7.0.3", - "eslint": "^8.19.0", - "eslint-config-prettier": "^8.5.0", - "ovsx": "^0.5.2", - "prettier": "^2.7.1", - "tslib": "^2.4.0", - "typescript": "^4.7.4", - "vsce": "^2.9.2" - } -} diff --git a/pkgs/applications/editors/vscode/extensions/rust-analyzer/default.nix b/pkgs/applications/editors/vscode/extensions/rust-analyzer/default.nix deleted file mode 100644 index 368d6ff8e08c9..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/rust-analyzer/default.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ lib -, fetchFromGitHub -, vscode-utils -, jq -, rust-analyzer -, nodePackages -, moreutils -, esbuild -, pkg-config -, libsecret -, stdenv -, darwin -, setDefaultServerPath ? true -}: - -let - pname = "rust-analyzer"; - publisher = "rust-lang"; - - # Use the plugin version as in vscode marketplace, updated by update script. - inherit (vsix) version; - - releaseTag = "2023-03-06"; - - src = fetchFromGitHub { - owner = "rust-lang"; - repo = "rust-analyzer"; - rev = releaseTag; - sha256 = "sha256-Njlus+vY3N++qWE0JXrGjwcXY2QDFuOV/7NruBBMETY="; - }; - - build-deps = nodePackages."rust-analyzer-build-deps-../../applications/editors/vscode/extensions/rust-analyzer/build-deps"; - # FIXME: Making a new derivation to link `node_modules` and run `npm run package` - # will cause a build failure. - vsix = build-deps.override { - src = "${src}/editors/code"; - outputs = [ "vsix" "out" ]; - - inherit releaseTag; - - nativeBuildInputs = [ - jq moreutils esbuild - # Required by `keytar`, which is a dependency of `vsce`. - pkg-config libsecret - ] ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.AppKit - darwin.apple_sdk.frameworks.Security - ]; - - # Follows https://github.com/rust-lang/rust-analyzer/blob/41949748a6123fd6061eb984a47f4fe780525e63/xtask/src/dist.rs#L39-L65 - postRebuild = '' - jq ' - .version = $ENV.version | - .releaseTag = $ENV.releaseTag | - .enableProposedApi = false | - walk(del(.["$generated-start"]?) | del(.["$generated-end"]?)) - ' package.json | sponge package.json - - mkdir -p $vsix - # vsce ask for continue due to missing LICENSE.md - # Should be removed after https://github.com/rust-lang/rust-analyzer/commit/acd5c1f19bf7246107aaae7b6fe3f676a516c6d2 - echo y | npx vsce package -o $vsix/${pname}.zip - ''; - }; - -in -vscode-utils.buildVscodeExtension { - inherit version vsix; - name = "${pname}-${version}"; - src = "${vsix}/${pname}.zip"; - vscodeExtUniqueId = "${publisher}.${pname}"; - vscodeExtPublisher = publisher; - vscodeExtName = pname; - - nativeBuildInputs = lib.optionals setDefaultServerPath [ jq moreutils ]; - - preInstall = lib.optionalString setDefaultServerPath '' - jq '.contributes.configuration.properties."rust-analyzer.server.path".default = $s' \ - --arg s "${rust-analyzer}/bin/rust-analyzer" \ - package.json | sponge package.json - ''; - - meta = with lib; { - description = "An alternative rust language server to the RLS"; - homepage = "https://github.com/rust-lang/rust-analyzer"; - license = with licenses; [ mit asl20 ]; - maintainers = with maintainers; [ ]; - platforms = platforms.all; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/rust-analyzer/update.sh b/pkgs/applications/editors/vscode/extensions/rust-analyzer/update.sh deleted file mode 100755 index fbf62c3b9db4f..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/rust-analyzer/update.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p curl jq libarchive -#shellcheck shell=bash -set -euo pipefail -cd "$(dirname "$0")" -nixpkgs=../../../../../../ -node_packages="$nixpkgs/pkgs/development/node-packages" -owner=rust-lang -repo=rust-analyzer -ver=$( - curl -s "https://api.github.com/repos/$owner/$repo/releases" | - jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output -) -node_src="$(nix-build "$nixpkgs" -A rust-analyzer.src --no-out-link)/editors/code" - -# Check vscode compatibility -req_vscode_ver="$(jq '.engines.vscode' "$node_src/package.json" --raw-output)" -req_vscode_ver="${req_vscode_ver#^}" -cur_vscode_ver="$(nix-instantiate --eval --strict "$nixpkgs" -A vscode.version | tr -d '"')" -if [[ "$(nix-instantiate --eval --strict -E "(builtins.compareVersions \"$req_vscode_ver\" \"$cur_vscode_ver\")")" -gt 0 ]]; then - echo "vscode $cur_vscode_ver is incompatible with the extension requiring ^$req_vscode_ver" - exit 1 -fi - -extension_ver=$(curl "https://github.com/$owner/$repo/releases/download/$ver/rust-analyzer-linux-x64.vsix" -L | - bsdtar -xf - --to-stdout extension/package.json | # Use bsdtar to extract vsix(zip). - jq --raw-output '.version') -echo "Extension version: $extension_ver" - -# We need devDependencies to build vsix. -# `esbuild` is a binary package an is already in nixpkgs so we omit it here. -jq '{ name, version: $ver, dependencies: (.dependencies + .devDependencies | del(.esbuild)) }' "$node_src/package.json" \ - --arg ver "$extension_ver" \ - >"build-deps/package.json.new" - -old_deps="$(jq '.dependencies' build-deps/package.json)" -new_deps="$(jq '.dependencies' build-deps/package.json.new)" -if [[ "$old_deps" == "$new_deps" ]]; then - echo "package.json dependencies not changed, do simple version change" - - sed -E '/^ "rust-analyzer-build-deps/,+3 s/version = ".*"/version = "'"$extension_ver"'"/' \ - --in-place "$node_packages"/node-packages.nix - mv build-deps/package.json{.new,} -else - echo "package.json dependencies changed, updating nodePackages" - mv build-deps/package.json{.new,} - - ./"$node_packages"/generate.sh -fi - -echo "Remember to also update the releaseTag and hash in default.nix!" diff --git a/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/build-deps/package.json b/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/build-deps/package.json new file mode 100644 index 0000000000000..167f92fbede95 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/build-deps/package.json @@ -0,0 +1,23 @@ +{ + "name": "rust-analyzer", + "version": "0.3.1426", + "dependencies": { + "anser": "^2.1.1", + "d3": "^7.6.1", + "d3-graphviz": "^5.0.2", + "vscode-languageclient": "^8.0.2", + "@types/node": "~16.11.7", + "@types/vscode": "~1.66.0", + "@typescript-eslint/eslint-plugin": "^5.30.5", + "@typescript-eslint/parser": "^5.30.5", + "@vscode/test-electron": "^2.1.5", + "cross-env": "^7.0.3", + "eslint": "^8.19.0", + "eslint-config-prettier": "^8.5.0", + "ovsx": "^0.5.2", + "prettier": "^2.7.1", + "tslib": "^2.4.0", + "typescript": "^4.7.4", + "vsce": "^2.9.2" + } +} diff --git a/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/default.nix b/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/default.nix new file mode 100644 index 0000000000000..368d6ff8e08c9 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/default.nix @@ -0,0 +1,90 @@ +{ lib +, fetchFromGitHub +, vscode-utils +, jq +, rust-analyzer +, nodePackages +, moreutils +, esbuild +, pkg-config +, libsecret +, stdenv +, darwin +, setDefaultServerPath ? true +}: + +let + pname = "rust-analyzer"; + publisher = "rust-lang"; + + # Use the plugin version as in vscode marketplace, updated by update script. + inherit (vsix) version; + + releaseTag = "2023-03-06"; + + src = fetchFromGitHub { + owner = "rust-lang"; + repo = "rust-analyzer"; + rev = releaseTag; + sha256 = "sha256-Njlus+vY3N++qWE0JXrGjwcXY2QDFuOV/7NruBBMETY="; + }; + + build-deps = nodePackages."rust-analyzer-build-deps-../../applications/editors/vscode/extensions/rust-analyzer/build-deps"; + # FIXME: Making a new derivation to link `node_modules` and run `npm run package` + # will cause a build failure. + vsix = build-deps.override { + src = "${src}/editors/code"; + outputs = [ "vsix" "out" ]; + + inherit releaseTag; + + nativeBuildInputs = [ + jq moreutils esbuild + # Required by `keytar`, which is a dependency of `vsce`. + pkg-config libsecret + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.AppKit + darwin.apple_sdk.frameworks.Security + ]; + + # Follows https://github.com/rust-lang/rust-analyzer/blob/41949748a6123fd6061eb984a47f4fe780525e63/xtask/src/dist.rs#L39-L65 + postRebuild = '' + jq ' + .version = $ENV.version | + .releaseTag = $ENV.releaseTag | + .enableProposedApi = false | + walk(del(.["$generated-start"]?) | del(.["$generated-end"]?)) + ' package.json | sponge package.json + + mkdir -p $vsix + # vsce ask for continue due to missing LICENSE.md + # Should be removed after https://github.com/rust-lang/rust-analyzer/commit/acd5c1f19bf7246107aaae7b6fe3f676a516c6d2 + echo y | npx vsce package -o $vsix/${pname}.zip + ''; + }; + +in +vscode-utils.buildVscodeExtension { + inherit version vsix; + name = "${pname}-${version}"; + src = "${vsix}/${pname}.zip"; + vscodeExtUniqueId = "${publisher}.${pname}"; + vscodeExtPublisher = publisher; + vscodeExtName = pname; + + nativeBuildInputs = lib.optionals setDefaultServerPath [ jq moreutils ]; + + preInstall = lib.optionalString setDefaultServerPath '' + jq '.contributes.configuration.properties."rust-analyzer.server.path".default = $s' \ + --arg s "${rust-analyzer}/bin/rust-analyzer" \ + package.json | sponge package.json + ''; + + meta = with lib; { + description = "An alternative rust language server to the RLS"; + homepage = "https://github.com/rust-lang/rust-analyzer"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/update.sh b/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/update.sh new file mode 100755 index 0000000000000..fbf62c3b9db4f --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/rust-lang.rust-analyzer/update.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq libarchive +#shellcheck shell=bash +set -euo pipefail +cd "$(dirname "$0")" +nixpkgs=../../../../../../ +node_packages="$nixpkgs/pkgs/development/node-packages" +owner=rust-lang +repo=rust-analyzer +ver=$( + curl -s "https://api.github.com/repos/$owner/$repo/releases" | + jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output +) +node_src="$(nix-build "$nixpkgs" -A rust-analyzer.src --no-out-link)/editors/code" + +# Check vscode compatibility +req_vscode_ver="$(jq '.engines.vscode' "$node_src/package.json" --raw-output)" +req_vscode_ver="${req_vscode_ver#^}" +cur_vscode_ver="$(nix-instantiate --eval --strict "$nixpkgs" -A vscode.version | tr -d '"')" +if [[ "$(nix-instantiate --eval --strict -E "(builtins.compareVersions \"$req_vscode_ver\" \"$cur_vscode_ver\")")" -gt 0 ]]; then + echo "vscode $cur_vscode_ver is incompatible with the extension requiring ^$req_vscode_ver" + exit 1 +fi + +extension_ver=$(curl "https://github.com/$owner/$repo/releases/download/$ver/rust-analyzer-linux-x64.vsix" -L | + bsdtar -xf - --to-stdout extension/package.json | # Use bsdtar to extract vsix(zip). + jq --raw-output '.version') +echo "Extension version: $extension_ver" + +# We need devDependencies to build vsix. +# `esbuild` is a binary package an is already in nixpkgs so we omit it here. +jq '{ name, version: $ver, dependencies: (.dependencies + .devDependencies | del(.esbuild)) }' "$node_src/package.json" \ + --arg ver "$extension_ver" \ + >"build-deps/package.json.new" + +old_deps="$(jq '.dependencies' build-deps/package.json)" +new_deps="$(jq '.dependencies' build-deps/package.json.new)" +if [[ "$old_deps" == "$new_deps" ]]; then + echo "package.json dependencies not changed, do simple version change" + + sed -E '/^ "rust-analyzer-build-deps/,+3 s/version = ".*"/version = "'"$extension_ver"'"/' \ + --in-place "$node_packages"/node-packages.nix + mv build-deps/package.json{.new,} +else + echo "package.json dependencies changed, updating nodePackages" + mv build-deps/package.json{.new,} + + ./"$node_packages"/generate.sh +fi + +echo "Remember to also update the releaseTag and hash in default.nix!" diff --git a/pkgs/applications/editors/vscode/extensions/sumneko.lua/default.nix b/pkgs/applications/editors/vscode/extensions/sumneko.lua/default.nix new file mode 100644 index 0000000000000..6c9c72ca60942 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/sumneko.lua/default.nix @@ -0,0 +1,27 @@ +{ lib +, vscode-utils +, lua-language-server +}: + +vscode-utils.buildVscodeMarketplaceExtension { + mktplcRef = { + name = "lua"; + publisher = "sumneko"; + version = "3.5.6"; + sha256 = "sha256-Unzs9rX/0MlQprSvScdBCCFMeLCaGzWsMbcFqSKY2XY="; + }; + + patches = [ ./remove-chmod.patch ]; + + postInstall = '' + ln -sf ${lua-language-server}/bin/lua-language-server \ + $out/$installPrefix/server/bin/lua-language-server + ''; + + meta = with lib; { + description = "The Lua language server provides various language features for Lua to make development easier and faster."; + homepage = "https://marketplace.visualstudio.com/items?itemName=sumneko.lua"; + license = licenses.mit; + maintainers = with maintainers; [ lblasc ]; + }; +} diff --git a/pkgs/applications/editors/vscode/extensions/sumneko.lua/remove-chmod.patch b/pkgs/applications/editors/vscode/extensions/sumneko.lua/remove-chmod.patch new file mode 100644 index 0000000000000..8b9028625aa8e --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/sumneko.lua/remove-chmod.patch @@ -0,0 +1,16 @@ +diff --git a/client/out/languageserver.js b/client/out/languageserver.js +index 6c7429c..6f53aa4 100644 +--- a/client/out/languageserver.js ++++ b/client/out/languageserver.js +@@ -79,11 +79,9 @@ class LuaClient { + break; + case "linux": + command = this.context.asAbsolutePath(path.join('server', binDir ? binDir : 'bin-Linux', 'lua-language-server')); +- yield fs.promises.chmod(command, '777'); + break; + case "darwin": + command = this.context.asAbsolutePath(path.join('server', binDir ? binDir : 'bin-macOS', 'lua-language-server')); +- yield fs.promises.chmod(command, '777'); + break; + } + let serverOptions = { diff --git a/pkgs/applications/editors/vscode/extensions/terraform/default.nix b/pkgs/applications/editors/vscode/extensions/terraform/default.nix deleted file mode 100644 index e6e094bb1cb6f..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/terraform/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ lib, vscode-utils, terraform-ls }: -vscode-utils.buildVscodeMarketplaceExtension rec { - mktplcRef = { - name = "terraform"; - publisher = "hashicorp"; - version = "2.19.0"; - sha256 = "sha256-k/fcEJuELz0xkwivSrP6Nxtz861BLq1wR2ZDMXVrvkY="; - }; - - patches = [ ./fix-terraform-ls.patch ]; - - postPatch = '' - substituteInPlace out/serverPath.js --replace TERRAFORM-LS-PATH ${terraform-ls}/bin/terraform-ls - ''; - - meta = with lib; { - license = licenses.mit; - maintainers = with maintainers; [ rhoriguchi ]; - }; -} diff --git a/pkgs/applications/editors/vscode/extensions/terraform/fix-terraform-ls.patch b/pkgs/applications/editors/vscode/extensions/terraform/fix-terraform-ls.patch deleted file mode 100644 index e2dcd0b70aa99..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/terraform/fix-terraform-ls.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/out/serverPath.js b/out/serverPath.js -index fafa915..2e6d376 100644 ---- a/out/serverPath.js -+++ b/out/serverPath.js -@@ -18,7 +18,13 @@ exports.CUSTOM_BIN_PATH_OPTION_NAME = 'languageServer.pathToBinary'; - class ServerPath { - constructor(context) { - this.context = context; -- this.customBinPath = vscode.workspace.getConfiguration('terraform').get(exports.CUSTOM_BIN_PATH_OPTION_NAME); -+ -+ const customBinPath = vscode.workspace.getConfiguration('terraform').get(exports.CUSTOM_BIN_PATH_OPTION_NAME); -+ if (!customBinPath) { -+ this.customBinPath = 'TERRAFORM-LS-PATH'; -+ } else { -+ this.customBinPath = customBinPath; -+ } - } - installPath() { - return path.join(this.context.globalStorageUri.fsPath, INSTALL_FOLDER_NAME); diff --git a/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/default.nix b/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/default.nix new file mode 100644 index 0000000000000..08f947ea46bc9 --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/default.nix @@ -0,0 +1,17 @@ +# This file has been generated by node2nix 1.11.1. Do not edit! + +{pkgs ? import { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}: + +let + nodeEnv = import ./node-env.nix { + inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit pkgs nodejs; + libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit nodeEnv; +} diff --git a/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/node-env.nix b/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/node-env.nix new file mode 100644 index 0000000000000..2590dd267a4ef --- /dev/null +++ b/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/build-deps/node-env.nix @@ -0,0 +1,598 @@ +# This file originates from node2nix + +{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: + +let + # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master + utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux; + + python = if nodejs ? python then nodejs.python else python2; + + # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise + tarWrapper = runCommand "tarWrapper" {} '' + mkdir -p $out/bin + + cat > $out/bin/tar <> $out/nix-support/hydra-build-products + ''; + }; + + # Common shell logic + installPackage = writeShellScript "install-package" '' + installPackage() { + local packageName=$1 src=$2 + + local strippedName + + local DIR=$PWD + cd $TMPDIR + + unpackFile $src + + # Make the base dir in which the target dependency resides first + mkdir -p "$(dirname "$DIR/$packageName")" + + if [ -f "$src" ] + then + # Figure out what directory has been unpacked + packageDir="$(find . -maxdepth 1 -type d | tail -1)" + + # Restore write permissions to make building work + find "$packageDir" -type d -exec chmod u+x {} \; + chmod -R u+w "$packageDir" + + # Move the extracted tarball into the output folder + mv "$packageDir" "$DIR/$packageName" + elif [ -d "$src" ] + then + # Get a stripped name (without hash) of the source directory. + # On old nixpkgs it's already set internally. + if [ -z "$strippedName" ] + then + strippedName="$(stripHash $src)" + fi + + # Restore write permissions to make building work + chmod -R u+w "$strippedName" + + # Move the extracted directory into the output folder + mv "$strippedName" "$DIR/$packageName" + fi + + # Change to the package directory to install dependencies + cd "$DIR/$packageName" + } + ''; + + # Bundle the dependencies of the package + # + # Only include dependencies if they don't exist. They may also be bundled in the package. + includeDependencies = {dependencies}: + lib.optionalString (dependencies != []) ( + '' + mkdir -p node_modules + cd node_modules + '' + + (lib.concatMapStrings (dependency: + '' + if [ ! -e "${dependency.packageName}" ]; then + ${composePackage dependency} + fi + '' + ) dependencies) + + '' + cd .. + '' + ); + + # Recursively composes the dependencies of a package + composePackage = { name, packageName, src, dependencies ? [], ... }@args: + builtins.addErrorContext "while evaluating node package '${packageName}'" '' + installPackage "${packageName}" "${src}" + ${includeDependencies { inherit dependencies; }} + cd .. + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ''; + + pinpointDependencies = {dependencies, production}: + let + pinpointDependenciesFromPackageJSON = writeTextFile { + name = "pinpointDependencies.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + function resolveDependencyVersion(location, name) { + if(location == process.env['NIX_STORE']) { + return null; + } else { + var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json"); + + if(fs.existsSync(dependencyPackageJSON)) { + var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON)); + + if(dependencyPackageObj.name == name) { + return dependencyPackageObj.version; + } + } else { + return resolveDependencyVersion(path.resolve(location, ".."), name); + } + } + } + + function replaceDependencies(dependencies) { + if(typeof dependencies == "object" && dependencies !== null) { + for(var dependency in dependencies) { + var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency); + + if(resolvedVersion === null) { + process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n"); + } else { + dependencies[dependency] = resolvedVersion; + } + } + } + } + + /* Read the package.json configuration */ + var packageObj = JSON.parse(fs.readFileSync('./package.json')); + + /* Pinpoint all dependencies */ + replaceDependencies(packageObj.dependencies); + if(process.argv[2] == "development") { + replaceDependencies(packageObj.devDependencies); + } + replaceDependencies(packageObj.optionalDependencies); + + /* Write the fixed package.json file */ + fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); + ''; + }; + in + '' + node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} + + ${lib.optionalString (dependencies != []) + '' + if [ -d node_modules ] + then + cd node_modules + ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} + cd .. + fi + ''} + ''; + + # Recursively traverses all dependencies of a package and pinpoints all + # dependencies in the package.json file to the versions that are actually + # being used. + + pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: + '' + if [ -d "${packageName}" ] + then + cd "${packageName}" + ${pinpointDependencies { inherit dependencies production; }} + cd .. + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + fi + ''; + + # 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 + ''; + + # Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty) + addIntegrityFieldsScript = writeTextFile { + name = "addintegrityfields.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + function augmentDependencies(baseDir, dependencies) { + for(var dependencyName in dependencies) { + var dependency = dependencies[dependencyName]; + + // Open package.json and augment metadata fields + var packageJSONDir = path.join(baseDir, "node_modules", dependencyName); + var packageJSONPath = path.join(packageJSONDir, "package.json"); + + if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored + console.log("Adding metadata fields to: "+packageJSONPath); + var packageObj = JSON.parse(fs.readFileSync(packageJSONPath)); + + if(dependency.integrity) { + packageObj["_integrity"] = dependency.integrity; + } else { + packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads. + } + + if(dependency.resolved) { + packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided + } else { + packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories. + } + + if(dependency.from !== undefined) { // Adopt from property if one has been provided + packageObj["_from"] = dependency.from; + } + + fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2)); + } + + // Augment transitive dependencies + if(dependency.dependencies !== undefined) { + augmentDependencies(packageJSONDir, dependency.dependencies); + } + } + } + + if(fs.existsSync("./package-lock.json")) { + var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); + + if(![1, 2].includes(packageLock.lockfileVersion)) { + process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); + process.exit(1); + } + + if(packageLock.dependencies !== undefined) { + augmentDependencies(".", packageLock.dependencies); + } + } + ''; + }; + + # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes + reconstructPackageLock = writeTextFile { + name = "addintegrityfields.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var lockObj = { + name: packageObj.name, + version: packageObj.version, + lockfileVersion: 1, + requires: true, + dependencies: {} + }; + + function augmentPackageJSON(filePath, dependencies) { + var packageJSON = path.join(filePath, "package.json"); + if(fs.existsSync(packageJSON)) { + var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + dependencies[packageObj.name] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: {} + }; + processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); + } + } + + function processDependencies(dir, dependencies) { + if(fs.existsSync(dir)) { + var files = fs.readdirSync(dir); + + files.forEach(function(entry) { + var filePath = path.join(dir, entry); + var stats = fs.statSync(filePath); + + if(stats.isDirectory()) { + if(entry.substr(0, 1) == "@") { + // When we encounter a namespace folder, augment all packages belonging to the scope + var pkgFiles = fs.readdirSync(filePath); + + pkgFiles.forEach(function(entry) { + if(stats.isDirectory()) { + var pkgFilePath = path.join(filePath, entry); + augmentPackageJSON(pkgFilePath, dependencies); + } + }); + } else { + augmentPackageJSON(filePath, dependencies); + } + } + }); + } + } + + processDependencies("node_modules", lockObj.dependencies); + + fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); + ''; + }; + + prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: + let + forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; + in + '' + # Pinpoint the versions of all dependencies to the ones that are actually being used + echo "pinpointing versions of dependencies..." + source $pinpointDependenciesScriptPath + + # Patch the shebangs of the bundled modules to prevent them from + # calling executables outside the Nix store as much as possible + patchShebangs . + + # Deploy the Node.js package by running npm install. Since the + # dependencies have been provided already by ourselves, it should not + # attempt to install them again, which is good, because we want to make + # it Nix's responsibility. If it needs to install any dependencies + # anyway (e.g. because the dependency parameters are + # incomplete/incorrect), it fails. + # + # The other responsibilities of NPM are kept -- version checks, build + # steps, postprocessing etc. + + export HOME=$TMPDIR + cd "${packageName}" + runHook preRebuild + + ${lib.optionalString bypassCache '' + ${lib.optionalString reconstructLock '' + if [ -f package-lock.json ] + then + echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" + echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!" + rm package-lock.json + else + echo "No package-lock.json file found, reconstructing..." + fi + + node ${reconstructPackageLock} + ''} + + node ${addIntegrityFieldsScript} + ''} + + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild + + if [ "''${dontNpmInstall-}" != "1" ] + then + # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. + rm -f npm-shrinkwrap.json + + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install + fi + ''; + + # Builds and composes an NPM package including all its dependencies + buildNodePackage = + { name + , packageName + , version ? null + , dependencies ? [] + , buildInputs ? [] + , production ? true + , npmFlags ? "" + , dontNpmInstall ? false + , bypassCache ? false + , reconstructLock ? false + , preRebuild ? "" + , dontStrip ? true + , unpackPhase ? "true" + , buildPhase ? "true" + , meta ? {} + , ... }@args: + + let + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; + in + stdenv.mkDerivation ({ + name = "${name}${if version == null then "" else "-${version}"}"; + buildInputs = [ tarWrapper python nodejs ] + ++ lib.optional (stdenv.isLinux) utillinux + ++ lib.optional (stdenv.isDarwin) libtool + ++ buildInputs; + + inherit nodejs; + + inherit dontStrip; # Stripping may fail a build for some package deployments + inherit dontNpmInstall preRebuild unpackPhase buildPhase; + + compositionScript = composePackage args; + pinpointDependenciesScript = pinpointDependenciesOfPackage args; + + passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; + + installPhase = '' + source ${installPackage} + + # Create and enter a root node_modules/ folder + mkdir -p $out/lib/node_modules + cd $out/lib/node_modules + + # Compose the package and all its dependencies + source $compositionScriptPath + + ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} + + # Create symlink to the deployed executable folder, if applicable + if [ -d "$out/lib/node_modules/.bin" ] + then + ln -s $out/lib/node_modules/.bin $out/bin + + # Patch the shebang lines of all the executables + ls $out/bin/* | while read i + do + file="$(readlink -f "$i")" + chmod u+rwx "$file" + patchShebangs "$file" + done + fi + + # Create symlinks to the deployed manual page folders, if applicable + if [ -d "$out/lib/node_modules/${packageName}/man" ] + then + mkdir -p $out/share + for dir in "$out/lib/node_modules/${packageName}/man/"* + do + mkdir -p $out/share/man/$(basename "$dir") + for page in "$dir"/* + do + ln -s $page $out/share/man/$(basename "$dir") + done + done + fi + + # Run post install hook, if provided + runHook postInstall + ''; + + meta = { + # default to Node.js' platforms + platforms = nodejs.meta.platforms; + } // meta; + } // extraArgs); + + # Builds a node environment (a node_modules folder and a set of binaries) + buildNodeDependencies = + { name + , packageName + , version ? null + , src + , dependencies ? [] + , buildInputs ? [] + , production ? true + , npmFlags ? "" + , dontNpmInstall ? false + , bypassCache ? false + , reconstructLock ? false + , dontStrip ? true + , unpackPhase ? "true" + , buildPhase ? "true" + , ... }@args: + + let + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; + in + stdenv.mkDerivation ({ + name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; + + buildInputs = [ tarWrapper python nodejs ] + ++ lib.optional (stdenv.isLinux) utillinux + ++ lib.optional (stdenv.isDarwin) libtool + ++ buildInputs; + + inherit dontStrip; # Stripping may fail a build for some package deployments + inherit dontNpmInstall unpackPhase buildPhase; + + includeScript = includeDependencies { inherit dependencies; }; + pinpointDependenciesScript = pinpointDependenciesOfPackage args; + + passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; + + installPhase = '' + source ${installPackage} + + mkdir -p $out/${packageName} + cd $out/${packageName} + + source $includeScriptPath + + # Create fake package.json to make the npm commands work properly + cp ${src}/package.json . + chmod 644 package.json + ${lib.optionalString bypassCache '' + if [ -f ${src}/package-lock.json ] + then + cp ${src}/package-lock.json . + chmod 644 package-lock.json + fi + ''} + + # Go to the parent folder to make sure that all packages are pinpointed + cd .. + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + + ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} + + # Expose the executables that were installed + cd .. + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + + mv ${packageName} lib + ln -s $out/lib/node_modules/.bin $out/bin + ''; + } // extraArgs); + + # Builds a development shell + buildNodeShell = + { name + , packageName + , version ? null + , src + , dependencies ? [] + , buildInputs ? [] + , production ? true + , npmFlags ? "" + , dontNpmInstall ? false + , bypassCache ? false + , reconstructLock ? false + , dontStrip ? true + , unpackPhase ? "true" + , buildPhase ? "true" + , ... }@args: + + let + nodeDependencies = buildNodeDependencies args; + extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; + in + stdenv.mkDerivation ({ + name = "node-shell-${name}${if version == null then "" else "-${version}"}"; + + buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; + buildCommand = '' + mkdir -p $out/bin + cat > $out/bin/shell < $version" + +# update hashes +sed -E 's/\bversion = ".*?"/version = "'$version'"/' --in-place "$nixFile" +srcHash=$(nix-prefetch fetchFromGitHub --owner vadimcn --repo vscode-lldb --rev "v$version") +sed -E 's#\bsha256 = ".*?"#sha256 = "'$srcHash'"#' --in-place "$nixFile" +cargoHash=$(nix-prefetch "{ sha256 }: (import $nixpkgs {}).vscode-extensions.vadimcn.vscode-lldb.adapter.cargoDeps.overrideAttrs (_: { outputHash = sha256; })") +sed -E 's#\bcargoSha256 = ".*?"#cargoSha256 = "'$cargoHash'"#' --in-place "$nixFile" + +# update node dependencies +src="$(nix-build $nixpkgs -A vscode-extensions.vadimcn.vscode-lldb.src --no-out-link)" +nix-shell -p node2nix -I nixpkgs=$nixpkgs --run "cd build-deps && ls -R && node2nix -14 -d -i \"$src/package.json\" -l \"$src/package-lock.json\"" diff --git a/pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/default.nix b/pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/default.nix deleted file mode 100644 index 08f947ea46bc9..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -# This file has been generated by node2nix 1.11.1. Do not edit! - -{pkgs ? import { - inherit system; - }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}: - -let - nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; - inherit pkgs nodejs; - libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; - }; -in -import ./node-packages.nix { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; - inherit nodeEnv; -} diff --git a/pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/node-env.nix b/pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/node-env.nix deleted file mode 100644 index 2590dd267a4ef..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/vscode-lldb/build-deps/node-env.nix +++ /dev/null @@ -1,598 +0,0 @@ -# This file originates from node2nix - -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: - -let - # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master - utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux; - - python = if nodejs ? python then nodejs.python else python2; - - # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise - tarWrapper = runCommand "tarWrapper" {} '' - mkdir -p $out/bin - - cat > $out/bin/tar <> $out/nix-support/hydra-build-products - ''; - }; - - # Common shell logic - installPackage = writeShellScript "install-package" '' - installPackage() { - local packageName=$1 src=$2 - - local strippedName - - local DIR=$PWD - cd $TMPDIR - - unpackFile $src - - # Make the base dir in which the target dependency resides first - mkdir -p "$(dirname "$DIR/$packageName")" - - if [ -f "$src" ] - then - # Figure out what directory has been unpacked - packageDir="$(find . -maxdepth 1 -type d | tail -1)" - - # Restore write permissions to make building work - find "$packageDir" -type d -exec chmod u+x {} \; - chmod -R u+w "$packageDir" - - # Move the extracted tarball into the output folder - mv "$packageDir" "$DIR/$packageName" - elif [ -d "$src" ] - then - # Get a stripped name (without hash) of the source directory. - # On old nixpkgs it's already set internally. - if [ -z "$strippedName" ] - then - strippedName="$(stripHash $src)" - fi - - # Restore write permissions to make building work - chmod -R u+w "$strippedName" - - # Move the extracted directory into the output folder - mv "$strippedName" "$DIR/$packageName" - fi - - # Change to the package directory to install dependencies - cd "$DIR/$packageName" - } - ''; - - # Bundle the dependencies of the package - # - # Only include dependencies if they don't exist. They may also be bundled in the package. - includeDependencies = {dependencies}: - lib.optionalString (dependencies != []) ( - '' - mkdir -p node_modules - cd node_modules - '' - + (lib.concatMapStrings (dependency: - '' - if [ ! -e "${dependency.packageName}" ]; then - ${composePackage dependency} - fi - '' - ) dependencies) - + '' - cd .. - '' - ); - - # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: - builtins.addErrorContext "while evaluating node package '${packageName}'" '' - installPackage "${packageName}" "${src}" - ${includeDependencies { inherit dependencies; }} - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - ''; - - pinpointDependencies = {dependencies, production}: - let - pinpointDependenciesFromPackageJSON = writeTextFile { - name = "pinpointDependencies.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - function resolveDependencyVersion(location, name) { - if(location == process.env['NIX_STORE']) { - return null; - } else { - var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json"); - - if(fs.existsSync(dependencyPackageJSON)) { - var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON)); - - if(dependencyPackageObj.name == name) { - return dependencyPackageObj.version; - } - } else { - return resolveDependencyVersion(path.resolve(location, ".."), name); - } - } - } - - function replaceDependencies(dependencies) { - if(typeof dependencies == "object" && dependencies !== null) { - for(var dependency in dependencies) { - var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency); - - if(resolvedVersion === null) { - process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n"); - } else { - dependencies[dependency] = resolvedVersion; - } - } - } - } - - /* Read the package.json configuration */ - var packageObj = JSON.parse(fs.readFileSync('./package.json')); - - /* Pinpoint all dependencies */ - replaceDependencies(packageObj.dependencies); - if(process.argv[2] == "development") { - replaceDependencies(packageObj.devDependencies); - } - replaceDependencies(packageObj.optionalDependencies); - - /* Write the fixed package.json file */ - fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); - ''; - }; - in - '' - node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} - - ${lib.optionalString (dependencies != []) - '' - if [ -d node_modules ] - then - cd node_modules - ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} - cd .. - fi - ''} - ''; - - # Recursively traverses all dependencies of a package and pinpoints all - # dependencies in the package.json file to the versions that are actually - # being used. - - pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: - '' - if [ -d "${packageName}" ] - then - cd "${packageName}" - ${pinpointDependencies { inherit dependencies production; }} - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - fi - ''; - - # 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 - ''; - - # Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty) - addIntegrityFieldsScript = writeTextFile { - name = "addintegrityfields.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - function augmentDependencies(baseDir, dependencies) { - for(var dependencyName in dependencies) { - var dependency = dependencies[dependencyName]; - - // Open package.json and augment metadata fields - var packageJSONDir = path.join(baseDir, "node_modules", dependencyName); - var packageJSONPath = path.join(packageJSONDir, "package.json"); - - if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored - console.log("Adding metadata fields to: "+packageJSONPath); - var packageObj = JSON.parse(fs.readFileSync(packageJSONPath)); - - if(dependency.integrity) { - packageObj["_integrity"] = dependency.integrity; - } else { - packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads. - } - - if(dependency.resolved) { - packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided - } else { - packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories. - } - - if(dependency.from !== undefined) { // Adopt from property if one has been provided - packageObj["_from"] = dependency.from; - } - - fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2)); - } - - // Augment transitive dependencies - if(dependency.dependencies !== undefined) { - augmentDependencies(packageJSONDir, dependency.dependencies); - } - } - } - - if(fs.existsSync("./package-lock.json")) { - var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); - - if(![1, 2].includes(packageLock.lockfileVersion)) { - process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); - process.exit(1); - } - - if(packageLock.dependencies !== undefined) { - augmentDependencies(".", packageLock.dependencies); - } - } - ''; - }; - - # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes - reconstructPackageLock = writeTextFile { - name = "addintegrityfields.js"; - text = '' - var fs = require('fs'); - var path = require('path'); - - var packageObj = JSON.parse(fs.readFileSync("package.json")); - - var lockObj = { - name: packageObj.name, - version: packageObj.version, - lockfileVersion: 1, - requires: true, - dependencies: {} - }; - - function augmentPackageJSON(filePath, dependencies) { - var packageJSON = path.join(filePath, "package.json"); - if(fs.existsSync(packageJSON)) { - var packageObj = JSON.parse(fs.readFileSync(packageJSON)); - dependencies[packageObj.name] = { - version: packageObj.version, - integrity: "sha1-000000000000000000000000000=", - dependencies: {} - }; - processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); - } - } - - function processDependencies(dir, dependencies) { - if(fs.existsSync(dir)) { - var files = fs.readdirSync(dir); - - files.forEach(function(entry) { - var filePath = path.join(dir, entry); - var stats = fs.statSync(filePath); - - if(stats.isDirectory()) { - if(entry.substr(0, 1) == "@") { - // When we encounter a namespace folder, augment all packages belonging to the scope - var pkgFiles = fs.readdirSync(filePath); - - pkgFiles.forEach(function(entry) { - if(stats.isDirectory()) { - var pkgFilePath = path.join(filePath, entry); - augmentPackageJSON(pkgFilePath, dependencies); - } - }); - } else { - augmentPackageJSON(filePath, dependencies); - } - } - }); - } - } - - processDependencies("node_modules", lockObj.dependencies); - - fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); - ''; - }; - - prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: - let - forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; - in - '' - # Pinpoint the versions of all dependencies to the ones that are actually being used - echo "pinpointing versions of dependencies..." - source $pinpointDependenciesScriptPath - - # Patch the shebangs of the bundled modules to prevent them from - # calling executables outside the Nix store as much as possible - patchShebangs . - - # Deploy the Node.js package by running npm install. Since the - # dependencies have been provided already by ourselves, it should not - # attempt to install them again, which is good, because we want to make - # it Nix's responsibility. If it needs to install any dependencies - # anyway (e.g. because the dependency parameters are - # incomplete/incorrect), it fails. - # - # The other responsibilities of NPM are kept -- version checks, build - # steps, postprocessing etc. - - export HOME=$TMPDIR - cd "${packageName}" - runHook preRebuild - - ${lib.optionalString bypassCache '' - ${lib.optionalString reconstructLock '' - if [ -f package-lock.json ] - then - echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" - echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!" - rm package-lock.json - else - echo "No package-lock.json file found, reconstructing..." - fi - - node ${reconstructPackageLock} - ''} - - node ${addIntegrityFieldsScript} - ''} - - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild - - if [ "''${dontNpmInstall-}" != "1" ] - then - # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. - rm -f npm-shrinkwrap.json - - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install - fi - ''; - - # Builds and composes an NPM package including all its dependencies - buildNodePackage = - { name - , packageName - , version ? null - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , preRebuild ? "" - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , meta ? {} - , ... }@args: - - let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; - in - stdenv.mkDerivation ({ - name = "${name}${if version == null then "" else "-${version}"}"; - buildInputs = [ tarWrapper python nodejs ] - ++ lib.optional (stdenv.isLinux) utillinux - ++ lib.optional (stdenv.isDarwin) libtool - ++ buildInputs; - - inherit nodejs; - - inherit dontStrip; # Stripping may fail a build for some package deployments - inherit dontNpmInstall preRebuild unpackPhase buildPhase; - - compositionScript = composePackage args; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; - - passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; - - installPhase = '' - source ${installPackage} - - # Create and enter a root node_modules/ folder - mkdir -p $out/lib/node_modules - cd $out/lib/node_modules - - # Compose the package and all its dependencies - source $compositionScriptPath - - ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} - - # Create symlink to the deployed executable folder, if applicable - if [ -d "$out/lib/node_modules/.bin" ] - then - ln -s $out/lib/node_modules/.bin $out/bin - - # Patch the shebang lines of all the executables - ls $out/bin/* | while read i - do - file="$(readlink -f "$i")" - chmod u+rwx "$file" - patchShebangs "$file" - done - fi - - # Create symlinks to the deployed manual page folders, if applicable - if [ -d "$out/lib/node_modules/${packageName}/man" ] - then - mkdir -p $out/share - for dir in "$out/lib/node_modules/${packageName}/man/"* - do - mkdir -p $out/share/man/$(basename "$dir") - for page in "$dir"/* - do - ln -s $page $out/share/man/$(basename "$dir") - done - done - fi - - # Run post install hook, if provided - runHook postInstall - ''; - - meta = { - # default to Node.js' platforms - platforms = nodejs.meta.platforms; - } // meta; - } // extraArgs); - - # Builds a node environment (a node_modules folder and a set of binaries) - buildNodeDependencies = - { name - , packageName - , version ? null - , src - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; - in - stdenv.mkDerivation ({ - name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; - - buildInputs = [ tarWrapper python nodejs ] - ++ lib.optional (stdenv.isLinux) utillinux - ++ lib.optional (stdenv.isDarwin) libtool - ++ buildInputs; - - inherit dontStrip; # Stripping may fail a build for some package deployments - inherit dontNpmInstall unpackPhase buildPhase; - - includeScript = includeDependencies { inherit dependencies; }; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; - - passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; - - installPhase = '' - source ${installPackage} - - mkdir -p $out/${packageName} - cd $out/${packageName} - - source $includeScriptPath - - # Create fake package.json to make the npm commands work properly - cp ${src}/package.json . - chmod 644 package.json - ${lib.optionalString bypassCache '' - if [ -f ${src}/package-lock.json ] - then - cp ${src}/package-lock.json . - chmod 644 package-lock.json - fi - ''} - - # Go to the parent folder to make sure that all packages are pinpointed - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - - ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} - - # Expose the executables that were installed - cd .. - ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} - - mv ${packageName} lib - ln -s $out/lib/node_modules/.bin $out/bin - ''; - } // extraArgs); - - # Builds a development shell - buildNodeShell = - { name - , packageName - , version ? null - , src - , dependencies ? [] - , buildInputs ? [] - , production ? true - , npmFlags ? "" - , dontNpmInstall ? false - , bypassCache ? false - , reconstructLock ? false - , dontStrip ? true - , unpackPhase ? "true" - , buildPhase ? "true" - , ... }@args: - - let - nodeDependencies = buildNodeDependencies args; - extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; - in - stdenv.mkDerivation ({ - name = "node-shell-${name}${if version == null then "" else "-${version}"}"; - - buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; - buildCommand = '' - mkdir -p $out/bin - cat > $out/bin/shell < $version" - -# update hashes -sed -E 's/\bversion = ".*?"/version = "'$version'"/' --in-place "$nixFile" -srcHash=$(nix-prefetch fetchFromGitHub --owner vadimcn --repo vscode-lldb --rev "v$version") -sed -E 's#\bsha256 = ".*?"#sha256 = "'$srcHash'"#' --in-place "$nixFile" -cargoHash=$(nix-prefetch "{ sha256 }: (import $nixpkgs {}).vscode-extensions.vadimcn.vscode-lldb.adapter.cargoDeps.overrideAttrs (_: { outputHash = sha256; })") -sed -E 's#\bcargoSha256 = ".*?"#cargoSha256 = "'$cargoHash'"#' --in-place "$nixFile" - -# update node dependencies -src="$(nix-build $nixpkgs -A vscode-extensions.vadimcn.vscode-lldb.src --no-out-link)" -nix-shell -p node2nix -I nixpkgs=$nixpkgs --run "cd build-deps && ls -R && node2nix -14 -d -i \"$src/package.json\" -l \"$src/package-lock.json\"" diff --git a/pkgs/applications/editors/vscode/extensions/vscode-utils.nix b/pkgs/applications/editors/vscode/extensions/vscode-utils.nix index eff075c493983..0eba230ad8e03 100644 --- a/pkgs/applications/editors/vscode/extensions/vscode-utils.nix +++ b/pkgs/applications/editors/vscode/extensions/vscode-utils.nix @@ -87,8 +87,8 @@ let builtins.map extensionFromVscodeMarketplace mktplcExtRefList; vscodeWithConfiguration = import ./vscodeWithConfiguration.nix { - inherit lib extensionsFromVscodeMarketplace writeShellScriptBin; - vscodeDefault = vscode; + inherit lib extensionsFromVscodeMarketplace writeShellScriptBin; + vscodeDefault = vscode; }; vscodeExts2nix = import ./vscodeExts2nix.nix { diff --git a/pkgs/applications/editors/vscode/extensions/wakatime/default.nix b/pkgs/applications/editors/vscode/extensions/wakatime/default.nix deleted file mode 100644 index 554b2bddb6cab..0000000000000 --- a/pkgs/applications/editors/vscode/extensions/wakatime/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ lib -, vscode-utils }: - -let - inherit (vscode-utils) buildVscodeMarketplaceExtension; -in - buildVscodeMarketplaceExtension { - mktplcRef = { - name = "vscode-wakatime"; - publisher = "WakaTime"; - version = "18.0.5"; - sha256 = "sha256-vWqGxMbxKqd4UgKK0sOKadMTDf6Y3TQxfWsc93MHjFs="; - }; - - meta = with lib; { - description = '' - Visual Studio Code plugin for automatic time tracking and metrics generated - from your programming activity - ''; - license = licenses.bsd3; - }; - } -- cgit 1.4.1