diff options
Diffstat (limited to 'nixpkgs/pkgs/misc/vscode-extensions')
34 files changed, 3281 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/misc/vscode-extensions/cpptools/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/cpptools/default.nix new file mode 100644 index 000000000000..188da860530a --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/cpptools/default.nix @@ -0,0 +1,102 @@ +{ lib, vscode-utils +, fetchurl, unzip +, mono, writeScript, runtimeShell +, jq, clang-tools +, gdbUseFixed ? true, gdb # The gdb default setting will be fixed to specified. Use version from `PATH` otherwise. +}: + +assert gdbUseFixed -> null != gdb; + +/* + 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: + + <https://github.com/Microsoft/MIEngine/blob/2885386dc7f35e0f1e44827269341e786361f28e/src/MICore/TerminalLauncher.cs#L156> + + Also, the extension should eventually no longer require an external terminal. See: + + <https://github.com/Microsoft/vscode-cpptools/issues/35> + + Once the symbolic link temporary solution taken, everything shoud run smootly. +*/ + +let + gdbDefaultsTo = if gdbUseFixed then "${gdb}/bin/gdb" else "gdb"; + + + openDebugAD7Script = writeScript "OpenDebugAD7" '' + #!${runtimeShell} + BIN_DIR="$(cd "$(dirname "$0")" && pwd -P)" + ${if gdbUseFixed + then '' + export PATH=''${PATH}''${PATH:+:}${gdb}/bin + '' + else ""} + ${mono}/bin/mono $BIN_DIR/bin/OpenDebugAD7.exe $* + ''; +in + +vscode-utils.buildVscodeMarketplaceExtension rec { + mktplcRef = { + name = "cpptools"; + publisher = "ms-vscode"; + version = "1.0.1"; + }; + + vsix = fetchurl { + name = "${mktplcRef.publisher}-${mktplcRef.name}.zip"; + url = "https://github.com/microsoft/vscode-cpptools/releases/download/${mktplcRef.version}/cpptools-linux.vsix"; + sha256 = "1lb5pza2ny1ydan19596amabs1np10nq08yqsfbvvfw7zbg4gnyc"; + }; + + buildInputs = [ + jq + ]; + + 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" + + # Mono runtimes from nix package (used by generated `OpenDebugAD7`). + mv ./debugAdapters/OpenDebugAD7 ./debugAdapters/OpenDebugAD7_orig + cp -p "${openDebugAD7Script}" "./debugAdapters/OpenDebugAD7" + + # Clang-format from nix package. + mv ./LLVM/ ./LLVM_orig + mkdir "./LLVM/" + find "${clang-tools}" -mindepth 1 -maxdepth 1 | xargs ln -s -t "./LLVM" + + # Patching cpptools and cpptools-srv + elfInterpreter="$(cat $NIX_CC/nix-support/dynamic-linker)" + patchelf --set-interpreter "$elfInterpreter" ./bin/cpptools + patchelf --set-interpreter "$elfInterpreter" ./bin/cpptools-srv + chmod a+x ./bin/cpptools{-srv,} + ''; + + meta = with lib; { + license = licenses.unfree; + maintainers = [ maintainers.jraygauthier ]; + # A 32 bit linux would also be possible with some effort (specific download of binaries + + # patching of the elf files with 32 bit interpreter). + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/cpptools/missing_elf_deps.sh b/nixpkgs/pkgs/misc/vscode-extensions/cpptools/missing_elf_deps.sh new file mode 100755 index 000000000000..f5eb08d78a5d --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/cpptools/missing_elf_deps.sh @@ -0,0 +1,52 @@ +#!/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 <nixpkgs> {}); ${pkg}" + echo "$(nix-build -E "$nixExp" --no-out-link)${suffix}" +} + +interpreter="$(get_pkg_out "stdenv.glibc" "/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/nixpkgs/pkgs/misc/vscode-extensions/cpptools/package-activation-events.json b/nixpkgs/pkgs/misc/vscode-extensions/cpptools/package-activation-events.json new file mode 100644 index 000000000000..c2d8a10f340a --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/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/nixpkgs/pkgs/misc/vscode-extensions/cpptools/update_helper.sh b/nixpkgs/pkgs/misc/vscode-extensions/cpptools/update_helper.sh new file mode 100755 index 000000000000..00ef77553242 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/cpptools/update_helper.sh @@ -0,0 +1,168 @@ +#!/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() { + #echo "Removing \`tmpDir='$tmpDir'\`" + rm -rf -- "$tmpDir" + unset tmpDir + trap - INT TERM HUP EXIT +} +function make_trapped_tmpdir() { + tmpDir=$(mktemp -d) + trap rm_tmpdir INT TERM HUP 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/nixpkgs/pkgs/misc/vscode-extensions/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/default.nix new file mode 100644 index 000000000000..19b816fbc77e --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/default.nix @@ -0,0 +1,1449 @@ +{ config, lib, buildEnv, callPackage, vscode-utils, asciidoctor, nodePackages, jdk, llvmPackages_8, nixpkgs-fmt, jq, shellcheck }: + +let + inherit (vscode-utils) buildVscodeMarketplaceExtension; + + # + # Unless there is a good reason not to, we attempt to use the same name as the + # extension's unique identifier (the name the extension gets when installed + # from vscode under `~/.vscode`) and found on the marketplace extension page. + # So an extension's attribute name should be of the form: + # "${mktplcRef.publisher}.${mktplcRef.name}". + # + baseExtensions = self: lib.mapAttrs (_n: lib.recurseIntoAttrs) + { + _4ops.terraform = buildVscodeMarketplaceExtension { + mktplcRef = { + publisher = "4ops"; + name = "terraform"; + version = "0.2.1"; + sha256 = "196026a89pizj8p0hqdgkyllj2spx2qwpynsaqjq17s8v15vk5dg"; + }; + meta = { + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kamadorueda ]; + }; + }; + + a5huynh.vscode-ron = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-ron"; + publisher = "a5huynh"; + version = "0.9.0"; + sha256 = "0d3p50mhqp550fmj662d3xklj14gvzvhszm2hlqvx4h28v222z97"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + alanz.vscode-hie-server = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-hie-server"; + publisher = "alanz"; + version = "0.0.27"; # see the note above + sha256 = "1mz0h5zd295i73hbji9ivla8hx02i4yhqcv6l4r23w3f07ql3i8h"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + alefragnani.project-manager = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "project-manager"; + publisher = "alefragnani"; + version = "12.1.0"; + sha256 = "sha256-fYBKmWn9pJh2V0fGdqVrXj9zIl8oTrZcBycDaMOXL/8="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + alexdima.copy-relative-path = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "copy-relative-path"; + publisher = "alexdima"; + version = "0.0.2"; + sha256 = "06g601n9d6wyyiz659w60phgm011gn9jj5fy0gf5wpi2bljk3vcn"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + alygin.vscode-tlaplus = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-tlaplus"; + publisher = "alygin"; + version = "1.5.3"; + sha256 = "1cy0qn8iyjrinscn9p5ckpsa2hyryapxfi7is6s2zk2mpligbb1d"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + antfu.icons-carbon = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "icons-carbon"; + publisher = "antfu"; + version = "0.2.2"; + sha256 = "0mfap16la09mn0jhvy8s3dainrmjz64vra7d0d4fbcpgg420kv3f"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + arrterian.nix-env-selector = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "nix-env-selector"; + publisher = "arrterian"; + version = "1.0.7"; + sha256 = "0e76885c9dbb6dca4eac8a75866ec372b948cc64a3a3845327d7c3ef6ba42a57"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + asciidoctor.asciidoctor-vscode = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "asciidoctor-vscode"; + publisher = "asciidoctor"; + version = "2.8.9"; + sha256 = "1xkxx5i3nhd0dzqhhdmx0li5jifsgfhv0p5h7xwsscz3gzgsdcyb"; + }; + + postPatch = '' + substituteInPlace dist/src/text-parser.js \ + --replace "get('asciidoctor_command', 'asciidoctor')" \ + "get('asciidoctor_command', '${asciidoctor}/bin/asciidoctor')" + substituteInPlace dist/src/commands/exportAsPDF.js \ + --replace "get('asciidoctorpdf_command', 'asciidoctor-pdf')" \ + "get('asciidoctorpdf_command', '${asciidoctor}/bin/asciidoctor-pdf')" + ''; + + meta = with lib; { + license = licenses.mit; + }; + }; + + ms-python.vscode-pylance = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-pylance"; + publisher = "MS-python"; + version = "2020.11.2"; + sha256 = "0n2dm21vgzir3hx1m3pmx7jq4zy3hdxfsandd2wv5da4fs9b5g50"; + }; + + buildInputs = [ nodePackages.pyright ]; + + meta = { + license = lib.licenses.unfree; + }; + }; + + b4dm4n.vscode-nixpkgs-fmt = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "nixpkgs-fmt"; + publisher = "B4dM4n"; + version = "0.0.1"; + sha256 = "sha256-vz2kU36B1xkLci2QwLpl/SBEhfSWltIDJ1r7SorHcr8="; + }; + nativeBuildInputs = [ jq ]; + postInstall = '' + cd "$out/$installPrefix" + tmp_package_json=$(mktemp) + jq '.contributes.configuration.properties."nixpkgs-fmt.path".default = "${nixpkgs-fmt}/bin/nixpkgs-fmt"' package.json > "$tmp_package_json" + mv "$tmp_package_json" package.json + ''; + meta = with lib; { + license = licenses.mit; + }; + }; + + baccata.scaladex-search = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "scaladex-search"; + publisher = "baccata"; + version = "0.0.1"; + sha256 = "1y8p4rr8qq5ng52g4pbx8ayq04gi2869wrx68k69rl7ga7bzcyp9"; + }; + meta = { + license = lib.licenses.asl20; + }; + }; + + bbenoist.Nix = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "Nix"; + publisher = "bbenoist"; + version = "1.0.1"; + sha256 = "0zd0n9f5z1f0ckzfjr38xw2zzmcxg1gjrava7yahg5cvdcw6l35b"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + bodil.file-browser = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "file-browser"; + publisher = "bodil"; + version = "0.2.10"; + sha256 = "sha256-RW4vm0Hum9AeN4Rq7MSJOIHnALU0L1tBLKjaRLA2hL8="; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + bradlc.vscode-tailwindcss = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-tailwindcss"; + publisher = "bradlc"; + version = "0.6.6"; + sha256 = "sha256-CRd+caKHFOXBnePr/LqNkzw0kRGYvNSkf4ecNgedpdA="; + }; + meta = with lib; { + license = licenses.mpl20; + }; + }; + + brettm12345.nixfmt-vscode = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "nixfmt-vscode"; + publisher = "brettm12345"; + version = "0.0.1"; + sha256 = "07w35c69vk1l6vipnq3qfack36qcszqxn8j3v332bl0w6m02aa7k"; + }; + meta = with lib; { + license = licenses.mpl20; + }; + }; + + cmschuetz12.wal = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "wal"; + publisher = "cmschuetz12"; + version = "0.1.0"; + sha256 = "0q089jnzqzhjfnv0vlb5kf747s3mgz64r7q3zscl66zb2pz5q4zd"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + codezombiech.gitignore = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "gitignore"; + publisher = "codezombiech"; + version = "0.6.0"; + sha256 = "0gnc0691pwkd9s8ldqabmpfvj0236rw7bxvkf0bvmww32kv1ia0b"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + CoenraadS.bracket-pair-colorizer = buildVscodeMarketplaceExtension { + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/CoenraadS.bracket-pair-colorizer/changelog"; + description = "A customizable extension for colorizing matching brackets"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer"; + homepage = "https://github.com/CoenraadS/BracketPair"; + license = licenses.mit; + maintainers = with maintainers; [ superherointj ]; + }; + mktplcRef = { + name = "bracket-pair-colorizer"; + publisher = "CoenraadS"; + version = "1.0.61"; + sha256 = "0r3bfp8kvhf9zpbiil7acx7zain26grk133f0r0syxqgml12i652"; + }; + }; + + coenraads.bracket-pair-colorizer-2 = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "bracket-pair-colorizer-2"; + publisher = "CoenraadS"; + version = "0.2.0"; + sha256 = "0nppgfbmw0d089rka9cqs3sbd5260dhhiipmjfga3nar9vp87slh"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + coolbear.systemd-unit-file = buildVscodeMarketplaceExtension { + mktplcRef = { + publisher = "coolbear"; + name = "systemd-unit-file"; + version = "1.0.6"; + sha256 = "0sc0zsdnxi4wfdlmaqwb6k2qc21dgwx6ipvri36x7agk7m8m4736"; + }; + meta = { + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kamadorueda ]; + }; + }; + + dbaeumer.vscode-eslint = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-eslint"; + publisher = "dbaeumer"; + version = "2.1.14"; + sha256 = "sha256-bVGmp871yu1Llr3uJ+CCosDsrxJtD4b1+CR+omMUfIQ="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + davidanson.vscode-markdownlint = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-markdownlint"; + publisher = "DavidAnson"; + version = "0.42.1"; + sha256 = "c8c0647e0dd786fe68becca6dc73eade5f4220a26ab9faff8dd813a14b25df51"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + dhall.dhall-lang = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "dhall-lang"; + publisher = "dhall"; + version = "0.0.4"; + sha256 = "0sa04srhqmngmw71slnrapi2xay0arj42j4gkan8i11n7bfi1xpf"; + }; + meta = { license = lib.licenses.mit; }; + }; + + dhall.vscode-dhall-lsp-server = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-dhall-lsp-server"; + publisher = "dhall"; + version = "0.0.4"; + sha256 = "1zin7s827bpf9yvzpxpr5n6mv0b5rhh3civsqzmj52mdq365d2js"; + }; + meta = { license = lib.licenses.mit; }; + }; + + donjayamanne.githistory = buildVscodeMarketplaceExtension { + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/donjayamanne.githistory/changelog"; + description = "View git log, file history, compare branches or commits"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory"; + homepage = "https://github.com/DonJayamanne/gitHistoryVSCode/"; + license = licenses.mit; + maintainers = with maintainers; [ superherointj ]; + }; + mktplcRef = { + name = "githistory"; + publisher = "donjayamanne"; + version = "0.6.14"; + sha256 = "11x116hzqnhgbryp2kqpki1z5mlnwxb0ly9r1513m5vgbisrsn0i"; + }; + }; + + dotjoshjohnson.xml = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "xml"; + publisher = "dotjoshjohnson"; + version = "2.5.1"; + sha256 = "1v4x6yhzny1f8f4jzm4g7vqmqg5bqchyx4n25mkgvw2xp6yls037"; + }; + meta = { + description = "XML Tools"; + homepage = "https://github.com/DotJoshJohnson/vscode-xml"; + license = lib.licenses.mit; + }; + }; + + dracula-theme.theme-dracula = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "theme-dracula"; + publisher = "dracula-theme"; + version = "2.22.3"; + sha256 = "0wni9sriin54ci8rly2s68lkfx8rj1cys6mgcizvps9sam6377w6"; + }; + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/dracula-theme.theme-dracula/changelog"; + description = "Dark theme for many editors, shells, and more"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=dracula-theme.theme-dracula"; + homepage = "https://draculatheme.com/"; + license = licenses.mit; + }; + }; + + eamodio.gitlens = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "gitlens"; + publisher = "eamodio"; + version = "11.5.1"; + sha256 = "sha256-Ic7eT8WX2GDYIj/aTu1d4m+fgPtXe4YQx04G0awbwnM="; + }; + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/eamodio.gitlens/changelog"; + description = "GitLens supercharges the Git capabilities built into Visual Studio Code."; + longDescription = '' + Supercharge the Git capabilities built into Visual Studio Code — Visualize code authorship at a glance via Git + blame annotations and code lens, seamlessly navigate and explore Git repositories, gain valuable insights via + powerful comparison commands, and so much more + ''; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens"; + homepage = "https://gitlens.amod.io/"; + license = licenses.mit; + maintainers = with maintainers; [ ratsclub ]; + }; + }; + + editorconfig.editorconfig = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "EditorConfig"; + publisher = "EditorConfig"; + version = "0.16.4"; + sha256 = "0fa4h9hk1xq6j3zfxvf483sbb4bd17fjl5cdm3rll7z9kaigdqwg"; + }; + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/EditorConfig.EditorConfig/changelog"; + description = "EditorConfig Support for Visual Studio Code"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig"; + homepage = "https://github.com/editorconfig/editorconfig-vscode"; + license = licenses.mit; + maintainers = with maintainers; [ dbirks ]; + }; + }; + + edonet.vscode-command-runner = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-command-runner"; + publisher = "edonet"; + version = "0.0.116"; + sha256 = "0fxvplyk080m0cdsvzynp6wjillrd4flr5qz7af7fibb2jbmfdkn"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + elmtooling.elm-ls-vscode = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "elm-ls-vscode"; + publisher = "Elmtooling"; + version = "2.0.1"; + sha256 = "06x5ld2r1hzns2s052mvhmfiaawjzcn0jf5lkfprhmrkxnmfdd43"; + }; + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/Elmtooling.elm-ls-vscode/changelog"; + description = "Elm language server"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=Elmtooling.elm-ls-vscode"; + homepage = "https://github.com/elm-tooling/elm-language-client-vscode"; + license = licenses.mit; + maintainers = with maintainers; [ mcwitt ]; + }; + }; + + emmanuelbeziat.vscode-great-icons = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-great-icons"; + publisher = "emmanuelbeziat"; + version = "2.1.64"; + sha256 = "sha256-qsL1vWiEAYeWkMDNSrr1yzg0QxroEQQeznoDL3Ujy/o="; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + esbenp.prettier-vscode = buildVscodeMarketplaceExtension { + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/esbenp.prettier-vscode/changelog"; + description = "Code formatter using prettier"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode"; + homepage = "https://github.com/prettier/prettier-vscode"; + license = licenses.mit; + maintainers = with maintainers; [ superherointj ]; + }; + mktplcRef = { + name = "prettier-vscode"; + publisher = "esbenp"; + version = "5.8.0"; + sha256 = "0h7wc4pffyq1i8vpj4a5az02g2x04y7y1chilmcfmzg2w42xpby7"; + }; + }; + + file-icons.file-icons = buildVscodeMarketplaceExtension { + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/file-icons.file-icons/changelog"; + description = "File-specific icons in VSCode for improved visual grepping."; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=file-icons.file-icons"; + homepage = "https://github.com/file-icons/vscode"; + license = licenses.mit; + maintainers = with maintainers; [ superherointj ]; + }; + mktplcRef = { + name = "file-icons"; + publisher = "file-icons"; + version = "1.0.28"; + sha256 = "1lyx0l42xhi2f3rdnjddc3mw7m913kjnchawi98i6vqsx3dv7091"; + }; + }; + + foam.foam-vscode = buildVscodeMarketplaceExtension { + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/foam.foam-vscode/changelog"; + description = "A personal knowledge management and sharing system for VSCode "; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=foam.foam-vscode"; + homepage = "https://foambubble.github.io/"; + license = licenses.mit; + maintainers = with maintainers; [ ratsclub ]; + }; + mktplcRef = { + name = "foam-vscode"; + publisher = "foam"; + version = "0.13.7"; + sha256 = "Y2pcd4iXPiuhJdD/9d+tbTJN18O4+kRMqUdOtbx8xy8="; + }; + }; + + formulahendry.auto-close-tag = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "auto-close-tag"; + publisher = "formulahendry"; + version = "0.5.6"; + sha256 = "058jgmllqb0j6gg5anghdp35nkykii28igfcwqgh4bp10pyvspg0"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + formulahendry.auto-rename-tag = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "auto-rename-tag"; + publisher = "formulahendry"; + version = "0.1.6"; + sha256 = "0cqg9mxkyf41brjq2c764w42lzyn6ffphw6ciw7xnqk1h1x8wwbs"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + formulahendry.code-runner = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "code-runner"; + publisher = "formulahendry"; + version = "0.11.2"; + sha256 = "0qwcxr6m1xwhqmdl4pccjgpikpq1hgi2hgrva5abn8ixa2510hcy"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + foxundermoon.shell-format = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "shell-format"; + publisher = "foxundermoon"; + version = "7.1.0"; + sha256 = "09z72mdr5bfdcb67xyzlv7lb9vyjlc3k9ackj4jgixfk40c68cnj"; + }; + meta = with lib; { + downloadPage = "https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format"; + homepage = "https://github.com/foxundermoon/vs-shell-format"; + license = licenses.mit; + maintainers = with maintainers; [ dbirks ]; + }; + }; + + freebroccolo.reasonml = buildVscodeMarketplaceExtension { + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/freebroccolo.reasonml/changelog"; + description = "Reason support for Visual Studio Code"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=freebroccolo.reasonml"; + homepage = "https://github.com/reasonml-editor/vscode-reasonml"; + license = licenses.asl20; + maintainers = with maintainers; [ superherointj ]; + }; + mktplcRef = { + name = "reasonml"; + publisher = "freebroccolo"; + version = "1.0.38"; + sha256 = "1nay6qs9vcxd85ra4bv93gg3aqg3r2wmcnqmcsy9n8pg1ds1vngd"; + }; + }; + + jkillian.custom-local-formatters = buildVscodeMarketplaceExtension { + mktplcRef = { + publisher = "jkillian"; + name = "custom-local-formatters"; + version = "0.0.4"; + sha256 = "1pmqnc759fq86g2z3scx5xqpni9khcqi5z2kpl1kb7yygsv314gm"; + }; + meta = { + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kamadorueda ]; + }; + }; + + github = { + github-vscode-theme = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "github-vscode-theme"; + publisher = "github"; + version = "4.1.1"; + sha256 = "14wz2b0bn1rnmpj28c0mivz2gacla2dgg8ncv7qfx9bsxhf95g68"; + }; + meta = with lib; { + description = "GitHub theme for VS Code"; + downloadPage = + "https://marketplace.visualstudio.com/items?itemName=GitHub.github-vscode-theme"; + homepage = "https://github.com/primer/github-vscode-theme"; + license = licenses.mit; + maintainers = with maintainers; [ hugolgst ]; + }; + }; + + vscode-pull-request-github = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-pull-request-github"; + publisher = "github"; + version = "0.22.0"; + sha256 = "13p3z86vkra26npp5a78pxdwa4z6jqjzsd38arhgdnjgwmi6bnrw"; + }; + meta = { license = lib.licenses.mit; }; + }; + }; + + golang.Go = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "Go"; + publisher = "golang"; + version = "0.25.1"; + sha256 = "sha256-ZDUWN9lzDnR77W7xcMFQaaFl/6Lf/x1jgaBkwZPqGGw="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + graphql.vscode-graphql = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-graphql"; + publisher = "GraphQL"; + version = "0.3.13"; + sha256 = "sha256-JjEefVHQUYidUsr8Ce/dh7hLDm21WkyS+2RwsXHoY04="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + gruntfuggly.todo-tree = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "todo-tree"; + publisher = "Gruntfuggly"; + version = "0.0.213"; + sha256 = "0fj7vvaqdldhbzm9dqh2plqlhg34jv5khd690xd87h418sv8rk95"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + haskell.haskell = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "haskell"; + publisher = "haskell"; + version = "1.1.0"; + sha256 = "1wg06lyk0qn9jd6gi007sg7v0z9z8gwq7x2449d4ihs9n3w5l0gb"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + hashicorp.terraform = callPackage ./terraform { }; + + hookyqr.beautify = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "beautify"; + publisher = "HookyQR"; + version = "1.5.0"; + sha256 = "1c0kfavdwgwham92xrh0gnyxkrl9qlkpv39l1yhrldn8vd10fj5i"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + ibm.output-colorizer = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "output-colorizer"; + publisher = "IBM"; + version = "0.1.2"; + sha256 = "0i9kpnlk3naycc7k8gmcxas3s06d67wxr3nnyv5hxmsnsx5sfvb7"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + iciclesoft.workspacesort = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "workspacesort"; + publisher = "iciclesoft"; + version = "1.6.0"; + sha256 = "1pbk8kflywll6lqhmffz9yjf01dn8xq8sk6rglnfn2kl2ildfhh6"; + }; + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/iciclesoft.workspacesort/changelog"; + description = "Sort workspace-folders alphabetically rather than in chronological order"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=iciclesoft.workspacesort"; + homepage = "https://github.com/iciclesoft/workspacesort-for-VSCode"; + license = licenses.mit; + maintainers = with maintainers; [ dbirks ]; + }; + }; + + ionide.ionide-fsharp = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "Ionide-fsharp"; + publisher = "Ionide"; + version = "5.5.5"; + sha256 = "xrBNiIbZVJ0sGUk/4PudD8kSyX94QkrFtf7Ho/sB0Vs="; + }; + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/Ionide.Ionide-fsharp/changelog"; + description = "Enhanced F# Language Features for Visual Studio Code"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-fsharp"; + homepage = "https://ionide.io"; + license = licenses.mit; + maintainers = with maintainers; [ ratsclub ]; + }; + }; + + jakebecker.elixir-ls = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "elixir-ls"; + publisher = "JakeBecker"; + version = "0.7.0"; + sha256 = "sha256-kFrkElD7qC1SpOx1rpcHW1D2hybHCf7cqvIO7JfPuMc="; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + james-yu.latex-workshop = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "latex-workshop"; + publisher = "James-Yu"; + version = "8.2.0"; + sha256 = "1ai16aam4v5jzhxgms589q0l24kyk1a9in6z4i7g05b3sahyxab2"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + jnoortheen.nix-ide = buildVscodeMarketplaceExtension { + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/jnoortheen.nix-ide/changelog"; + description = "Nix language support with formatting and error report"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=jnoortheen.nix-ide"; + homepage = "https://github.com/jnoortheen/vscode-nix-ide"; + license = licenses.mit; + maintainers = with maintainers; [ superherointj ]; + }; + mktplcRef = { + name = "nix-ide"; + publisher = "jnoortheen"; + version = "0.1.7"; + sha256 = "1bw4wyq9abimxbhl7q9g8grvj2ax9qqq6mmqbiqlbsi2arvk0wrm"; + }; + }; + + jock.svg = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "svg"; + publisher = "jock"; + version = "1.4.4"; + sha256 = "0kn2ic7pgbd4rbvzpsxfwyiwxa1iy92l0h3jsppxc8gk8xbqm2nc"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + johnpapa.vscode-peacock = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-peacock"; + publisher = "johnpapa"; + version = "3.9.1"; + sha256 = "1g7apzzgfm8s9sjavhwr8jpf9slhq8b9jfkww3q5n41mzzx8m94p"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + jpoissonnier.vscode-styled-components = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-styled-components"; + publisher = "jpoissonnier"; + version = "1.4.1"; + sha256 = "sha256-ojbeuYBCS+DjF5R0aLuBImzoSOb8mXw1s0Uh0CzggzE="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + justusadam.language-haskell = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "language-haskell"; + publisher = "justusadam"; + version = "3.2.1"; + sha256 = "0lxp8xz17ciy93nj4lzxqvz71vw1zdyamrnh2n792yair8890rr6"; + }; + meta = { + license = lib.licenses.bsd3; + }; + }; + + kahole.magit = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "magit"; + publisher = "kahole"; + version = "0.6.15"; + sha256 = "sha256-fRXm70FXnHduoywI4YC9ya6/J7wyd6EBzbnrcijBIbA="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + mads-hartmann.bash-ide-vscode = buildVscodeMarketplaceExtension { + mktplcRef = { + publisher = "mads-hartmann"; + name = "bash-ide-vscode"; + version = "1.11.0"; + sha256 = "1hq41fy2v1grjrw77mbs9k6ps6gncwlydm03ipawjnsinxc9rdkp"; + }; + meta = { + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kamadorueda ]; + }; + }; + + mikestead.dotenv = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "dotenv"; + publisher = "mikestead"; + version = "1.0.1"; + sha256 = "sha256-dieCzNOIcZiTGu4Mv5zYlG7jLhaEsJR05qbzzzQ7RWc="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + mishkinf.goto-next-previous-member = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "goto-next-previous-member"; + publisher = "mishkinf"; + version = "0.0.5"; + sha256 = "0kgzap1k924i95al0a63hxcsv8skhaapgfpi9d7vvaxm0fc10l1i"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + mskelton.one-dark-theme = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "one-dark-theme"; + publisher = "mskelton"; + version = "1.7.2"; + sha256 = "1ks6z8wsxmlfhiwa51f7d6digvw11dlxc7mja3hankgxcf5dyj31"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + mechatroner.rainbow-csv = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "rainbow-csv"; + publisher = "mechatroner"; + version = "1.7.1"; + sha256 = "0w5mijs4ll5qjkpyw7qpn1k40pq8spm0b3q72x150ydbcini5hxw"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + ms-azuretools.vscode-docker = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-docker"; + publisher = "ms-azuretools"; + version = "1.9.1"; + sha256 = "1l7pm3s5kbf2vark164ykz4qbpa1ac9ls691hham36f6v91dmff9"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + ms-dotnettools.csharp = callPackage ./ms-dotnettools-csharp { }; + + ms-kubernetes-tools.vscode-kubernetes-tools = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-kubernetes-tools"; + publisher = "ms-kubernetes-tools"; + version = "1.0.6"; + sha256 = "12a4phl1pddsajy3n0ld6rp607iy0pif6pqrs6ljbg2x97fyra28"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + ms-vscode.cpptools = callPackage ./cpptools { }; + + ms-vscode-remote.remote-ssh = callPackage ./remote-ssh { }; + + ms-python.python = callPackage ./python { + extractNuGet = callPackage ./python/extract-nuget.nix { }; + }; + + msjsdiag.debugger-for-chrome = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "debugger-for-chrome"; + publisher = "msjsdiag"; + version = "4.12.11"; + sha256 = "sha256-9i3TgCFThnFF5ccwzS4ATj5c2Xoe/4tDFGv75jJxeQ4="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + ms-toolsai.jupyter = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "jupyter"; + publisher = "ms-toolsai"; + version = "2021.5.745244803"; + sha256 = "0gjpsp61l8daqa87mpmxcrvsvb0pc2vwg7xbkvwn0f13c1739w9p"; + }; + meta = { + license = lib.licenses.unfree; + }; + }; + + naumovs.color-highlight = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "color-highlight"; + publisher = "naumovs"; + version = "2.3.0"; + sha256 = "1syzf43ws343z911fnhrlbzbx70gdn930q67yqkf6g0mj8lf2za2"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + octref.vetur = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vetur"; + publisher = "octref"; + version = "0.34.1"; + sha256 = "09w3bik1mxs7qac67wgrc58vl98ham3syrn2anycpwd7135wlpby"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + redhat.java = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "java"; + publisher = "redhat"; + version = "0.76.0"; + sha256 = "0xb9brki4s00piv4kqgz6idm16nk6x1j6502jljz7y9pif38z32y"; + }; + buildInputs = [ jdk ]; + meta = { + license = lib.licenses.epl20; + broken = lib.versionOlder jdk.version "11"; + }; + }; + + redhat.vscode-yaml = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-yaml"; + publisher = "redhat"; + version = "0.13.0"; + sha256 = "046kdk73a5xbrwq16ff0l64271c6q6ygjvxaph58z29gyiszfkig"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + rubymaniac.vscode-paste-and-indent = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-paste-and-indent"; + publisher = "Rubymaniac"; + version = "0.0.8"; + sha256 = "0fqwcvwq37ndms6vky8jjv0zliy6fpfkh8d9raq8hkinfxq6klgl"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + matklad.rust-analyzer = callPackage ./rust-analyzer { }; + + ocamllabs.ocaml-platform = buildVscodeMarketplaceExtension { + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/ocamllabs.ocaml-platform/changelog"; + description = "Official OCaml Support from OCamlLabs"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=ocamllabs.ocaml-platform"; + homepage = "https://github.com/ocamllabs/vscode-ocaml-platform"; + license = licenses.isc; + maintainers = with maintainers; [ superherointj ]; + }; + mktplcRef = { + name = "ocaml-platform"; + publisher = "ocamllabs"; + version = "1.5.1"; + sha256 = "0jkxpcrbr8xmwfl8jphmarjz2jk54hvmc24ww89d4bgx1awayqfh"; + }; + }; + + pkief.material-icon-theme = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "material-icon-theme"; + publisher = "pkief"; + version = "4.4.0"; + sha256 = "1m9mis59j9xnf1zvh67p5rhayaa9qxjiw9iw847nyl9vsy73w8ya"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + rubbersheep.gi = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "gi"; + publisher = "rubbersheep"; + version = "0.2.11"; + sha256 = "0j9k6wm959sziky7fh55awspzidxrrxsdbpz1d79s5lr5r19rs6j"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + ryu1kn.partial-diff = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "partial-diff"; + publisher = "ryu1kn"; + version = "1.4.1"; + sha256 = "1r4kg4slgxncdppr4fn7i5vfhvzcg26ljia2r97n6wvwn8534vs9"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + scala-lang.scala = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "scala"; + publisher = "scala-lang"; + version = "0.5.3"; + sha256 = "0isw8jh845hj2fw7my1i19b710v3m5qsjy2faydb529ssdqv463p"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + scalameta.metals = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "metals"; + publisher = "scalameta"; + version = "1.10.4"; + sha256 = "0q6zjpdi98png4vpzz39q85nxmsh3h1nnan58saz5rr83d6jgj89"; + }; + meta = { + license = lib.licenses.asl20; + }; + }; + + serayuzgur.crates = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "crates"; + publisher = "serayuzgur"; + version = "0.5.3"; + sha256 = "1xk7ayv590hsm3scqpyh6962kvgdlinnpkx0vapr7vs4y08dx72f"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + shardulm94.trailing-spaces = buildVscodeMarketplaceExtension { + mktplcRef = { + publisher = "shardulm94"; + name = "trailing-spaces"; + version = "0.3.1"; + sha256 = "0h30zmg5rq7cv7kjdr5yzqkkc1bs20d72yz9rjqag32gwf46s8b8"; + }; + meta = { + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kamadorueda ]; + }; + }; + + shyykoserhiy.vscode-spotify = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-spotify"; + publisher = "shyykoserhiy"; + version = "3.2.1"; + sha256 = "14d68rcnjx4a20r0ps9g2aycv5myyhks5lpfz0syr2rxr4kd1vh6"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + skyapps.fish-vscode = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "fish-vscode"; + publisher = "skyapps"; + version = "0.2.1"; + sha256 = "0y1ivymn81ranmir25zk83kdjpjwcqpnc9r3jwfykjd9x0jib2hl"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + slevesque.vscode-multiclip = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-multiclip"; + publisher = "slevesque"; + version = "0.1.5"; + sha256 = "1cg8dqj7f10fj9i0g6mi3jbyk61rs6rvg9aq28575rr52yfjc9f9"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + spywhere.guides = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "guides"; + publisher = "spywhere"; + version = "0.9.3"; + sha256 = "1kvsj085w1xax6fg0kvsj1cizqh86i0pkzpwi0sbfvmcq21i6ghn"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + stephlin.vscode-tmux-keybinding = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-tmux-keybinding"; + publisher = "stephlin"; + version = "0.0.6"; + sha256 = "0mph2nval1ddmv9hpl51fdvmagzkqsn8ljwqsfha2130bb7la0d9"; + }; + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/stephlin.vscode-tmux-keybinding/changelog"; + description = "A simple extension for tmux behavior in vscode terminal."; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=stephlin.vscode-tmux-keybinding"; + homepage = "https://github.com/StephLin/vscode-tmux-keybinding"; + license = licenses.mit; + maintainers = with maintainers; [ dbirks ]; + }; + }; + + streetsidesoftware.code-spell-checker = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "code-spell-checker"; + publisher = "streetsidesoftware"; + version = "1.10.2"; + sha256 = "1ll046rf5dyc7294nbxqk5ya56g2bzqnmxyciqpz2w5x7j75rjib"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + svelte.svelte-vscode = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "svelte-vscode"; + publisher = "svelte"; + version = "105.0.0"; + sha256 = "sha256-my3RzwUW5MnajAbEnqxtrIR701XH+AKYLbnKD7ivASE="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + svsool.markdown-memo = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "markdown-memo"; + publisher = "svsool"; + version = "0.3.8"; + sha256 = "eFiCCXxrOnXwJK1AOMfIDsPGsFG3ArLD1X/uAEH5lRY="; + }; + meta = with lib; { + changelog = "https://marketplace.visualstudio.com/items/svsool.markdown-memo/changelog"; + description = "Markdown knowledge base with bidirectional [[link]]s built on top of VSCode"; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=svsool.markdown-memo"; + homepage = "https://github.com/svsool/vscode-memo"; + license = licenses.mit; + maintainers = with maintainers; [ ratsclub ]; + }; + }; + + tamasfe.even-better-toml = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "even-better-toml"; + publisher = "tamasfe"; + version = "0.9.3"; + sha256 = "16x2y58hkankazpwm93j8lqdn3mala7iayck548kki9zx4qrhhck"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + tiehuis.zig = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "zig"; + publisher = "tiehuis"; + version = "0.2.5"; + sha256 = "sha256-P8Sep0OtdchTfnudxFNvIK+SW++TyibGVI9zd+B5tu4="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + + timonwong.shellcheck = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "shellcheck"; + publisher = "timonwong"; + version = "0.14.1"; + sha256 = "sha256-X3ihMxANcqNLWl9oTZjCgwRt1uBsSN2BmC2D4dPRFLE="; + }; + nativeBuildInputs = [ jq ]; + postInstall = '' + cd "$out/$installPrefix" + tmp_package_json=$(mktemp) + jq '.contributes.configuration.properties."shellcheck.executablePath".default = "${shellcheck}/bin/shellcheck"' package.json > "$tmp_package_json" + mv "$tmp_package_json" package.json + ''; + meta = { + license = lib.licenses.mit; + }; + }; + + tomoki1207.pdf = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "pdf"; + publisher = "tomoki1207"; + version = "1.1.0"; + sha256 = "0pcs4iy77v4f04f8m9w2rpdzfq7sqbspr7f2sm1fv7bm515qgsvb"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + tyriar.sort-lines = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "sort-lines"; + publisher = "Tyriar"; + version = "1.9.0"; + sha256 = "0l4wibsjnlbzbrl1wcj18vnm1q4ygvxmh347jvzziv8f1l790qjl"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + usernamehw.errorlens = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "errorlens"; + publisher = "usernamehw"; + version = "3.2.4"; + sha256 = "0caxmf6v0s5kgp6cp3j1kk7slhspjv5kzhn4sq3miyl5jkrn95kx"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + vadimcn.vscode-lldb = callPackage ./vscode-lldb { }; + + vincaslt.highlight-matching-tag = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "highlight-matching-tag"; + publisher = "vincaslt"; + version = "0.10.0"; + sha256 = "1albwz3lc9i20if77inm1ipwws8apigvx24rbag3d1h3p4vwda49"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + ms-vsliveshare.vsliveshare = callPackage ./ms-vsliveshare-vsliveshare { }; + + vscodevim.vim = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vim"; + publisher = "vscodevim"; + version = "1.11.3"; + sha256 = "1smzsgcrkhghbnpy51gp28kh74l7y4s2m8pfxabb4ffb751254j0"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + vspacecode.vspacecode = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vspacecode"; + publisher = "VSpaceCode"; + version = "0.9.1"; + sha256 = "sha256-/qJKYXR0DznqwF7XuJsz+OghIBzdWjm6dAlaRX4wdRU="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + vspacecode.whichkey = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "whichkey"; + publisher = "VSpaceCode"; + version = "0.8.5"; + sha256 = "sha256-p5fukIfk/tZFQrkf6VuT4fjmeGtKAqHDh6r6ky847ks="; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + wix.vscode-import-cost = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-import-cost"; + publisher = "wix"; + version = "2.15.0"; + sha256 = "0d3b6654cdck1syn74vmmd1jmgkrw5v4c4cyrhdxbhggkip732bc"; + }; + meta = with lib; { + license = licenses.mit; + }; + }; + + xaver.clang-format = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "clang-format"; + publisher = "xaver"; + version = "1.9.0"; + sha256 = "abd0ef9176eff864f278c548c944032b8f4d8ec97d9ac6e7383d60c92e258c2f"; + }; + meta = with lib; { + license = licenses.mit; + maintainers = [ maintainers.zeratax ]; + }; + }; + + xyz.local-history = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "local-history"; + publisher = "xyz"; + version = "1.8.1"; + sha256 = "1mfmnbdv76nvwg4xs3rgsqbxk8hw9zr1b61har9c3pbk9r4cay7v"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + yzhang.markdown-all-in-one = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "markdown-all-in-one"; + publisher = "yzhang"; + version = "3.4.0"; + sha256 = "0ihfrsg2sc8d441a2lkc453zbw1jcpadmmkbkaf42x9b9cipd5qb"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + zhuangtongfa.material-theme = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "material-theme"; + publisher = "zhuangtongfa"; + version = "3.9.12"; + sha256 = "017h9hxplf2rhmlhn3vag0wypcx6gxi7p9fgllj5jzwrl2wsjl0g"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + + llvm-org.lldb-vscode = llvmPackages_8.lldb; + + WakaTime.vscode-wakatime = callPackage ./wakatime { }; + + wholroyd.jinja = buildVscodeMarketplaceExtension { + mktplcRef = { + name = "jinja"; + publisher = "wholroyd"; + version = "0.0.8"; + sha256 = "1ln9gly5bb7nvbziilnay4q448h9npdh7sd9xy277122h0qawkci"; + }; + meta = { + license = lib.licenses.mit; + }; + }; + }; + + aliases = self: super: { + # aliases + ms-vscode = lib.recursiveUpdate super.ms-vscode { inherit (super.golang) Go; }; + }; + + # TODO: add overrides overlay, so that we can have a generated.nix + # then apply extension specific modifcations to packages. + + # overlays will be applied left to right, overrides should come after aliases. + overlays = lib.optionals (config.allowAliases or true) [ aliases ]; + + toFix = lib.foldl' (lib.flip lib.extends) baseExtensions overlays; +in +lib.fix toFix diff --git a/nixpkgs/pkgs/misc/vscode-extensions/mktplcExtRefToFetchArgs.nix b/nixpkgs/pkgs/misc/vscode-extensions/mktplcExtRefToFetchArgs.nix new file mode 100644 index 000000000000..a781250fc18b --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/mktplcExtRefToFetchArgs.nix @@ -0,0 +1,8 @@ +{ publisher, name, version, sha256 ? "" }: +{ + url = "https://${publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/${publisher}/extension/${name}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage"; + sha256 = sha256; + # The `*.vsix` file is in the end a simple zip file. Change the extension + # so that existing `unzip` hooks takes care of the unpacking. + name = "${publisher}-${name}.zip"; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/default.nix new file mode 100644 index 000000000000..6f4bbfb7e92e --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/default.nix @@ -0,0 +1,142 @@ +{ lib +, fetchurl +, vscode-utils +, unzip +, patchelf +, makeWrapper +, icu +, stdenv +, openssl +, mono +}: + +let + # Get as close as possible as the `package.json` required version. + # This is what drives omnisharp. + rtDepsSrcsFromJson = builtins.fromJSON (builtins.readFile ./rt-deps-bin-srcs.json); + + rtDepsBinSrcs = builtins.mapAttrs (k: v: + let + # E.g: "OmniSharp-x86_64-linux" + kSplit = builtins.split "(-)" k; + name = builtins.elemAt kSplit 0; + arch = builtins.elemAt kSplit 2; + platform = builtins.elemAt kSplit 4; + in + { + inherit name arch platform; + installPath = v.installPath; + binaries = v.binaries; + bin-src = fetchurl { + urls = v.urls; + inherit (v) sha256; + }; + } + ) + rtDepsSrcsFromJson; + + arch = "x86_64"; + platform = "linux"; + + rtDepBinSrcByName = bSrcName: + rtDepsBinSrcs."${bSrcName}-${arch}-${platform}"; + + omnisharp = rtDepBinSrcByName "OmniSharp"; + vsdbg = rtDepBinSrcByName "Debugger"; + razor = rtDepBinSrcByName "Razor"; +in + +vscode-utils.buildVscodeMarketplaceExtension { + mktplcRef = { + name = "csharp"; + publisher = "ms-dotnettools"; + version = "1.23.2"; + sha256 = "0ydaiy8jfd1bj50bqiaz5wbl7r6qwmbz9b29bydimq0rdjgapaar"; + }; + + nativeBuildInputs = [ + unzip + patchelf + makeWrapper + ]; + + 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" + + unzip_to() { + declare src_zip="''${1?}" + declare target_dir="''${2?}" + mkdir -p "$target_dir" + if unzip "$src_zip" -d "$target_dir"; then + true + elif [[ "1" -eq "$?" ]]; then + 1>&2 echo "WARNING: unzip('$?' -> skipped files)." + else + 1>&2 echo "ERROR: unzip('$?')." + fi + } + + patchelf_add_icu_as_needed() { + declare elf="''${1?}" + declare icu_major_v="${ + with builtins; head (splitVersion (parseDrvName icu.name).version)}" + + 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.out icu.out ]}:\$ORIGIN" \ + "$elf" + } + + declare omnisharp_dir="$PWD/${omnisharp.installPath}" + unzip_to "${omnisharp.bin-src}" "$omnisharp_dir" + rm "$omnisharp_dir/bin/mono" + ln -s -T "${mono}/bin/mono" "$omnisharp_dir/bin/mono" + chmod a+x "$omnisharp_dir/run" + touch "$omnisharp_dir/install.Lock" + + declare vsdbg_dir="$PWD/${vsdbg.installPath}" + unzip_to "${vsdbg.bin-src}" "$vsdbg_dir" + chmod a+x "$vsdbg_dir/vsdbg-ui" + chmod a+x "$vsdbg_dir/vsdbg" + touch "$vsdbg_dir/install.complete" + touch "$vsdbg_dir/install.Lock" + patchelf_common "$vsdbg_dir/vsdbg" + patchelf_common "$vsdbg_dir/vsdbg-ui" + + declare razor_dir="$PWD/${razor.installPath}" + unzip_to "${razor.bin-src}" "$razor_dir" + chmod a+x "$razor_dir/rzls" + touch "$razor_dir/install.Lock" + patchelf_common "$razor_dir/rzls" + ''; + + 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" ]; + }; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/rt-deps-bin-srcs.json b/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/rt-deps-bin-srcs.json new file mode 100644 index 000000000000..91ee056efc1f --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/rt-deps-bin-srcs.json @@ -0,0 +1,37 @@ +{ + "OmniSharp-x86_64-linux": { + "installPath": ".omnisharp/1.37.1", + "binaries": [ + "./mono.linux-x86_64", + "./run" + ], + "urls": [ + "https://download.visualstudio.microsoft.com/download/pr/46933d64-075c-4f9f-b205-da4a839e2e3c/4bba2c3f40106056b53721c164ff86fa/omnisharp-linux-x64-1.37.1.zip", + "https://roslynomnisharp.blob.core.windows.net/releases/1.37.1/omnisharp-linux-x64-1.37.1.zip" + ], + "sha256": "0yzxkbq0fyq2bv0s7qmycxl0w54lla0vykg1a5lpv9j38k062vvz" + }, + "Debugger-x86_64-linux": { + "installPath": ".debugger", + "binaries": [ + "./vsdbg-ui", + "./vsdbg" + ], + "urls": [ + "https://download.visualstudio.microsoft.com/download/pr/292d2e01-fb93-455f-a6b3-76cddad4f1ef/2e9b8bc5431d8f6c56025e76eaabbdff/coreclr-debug-linux-x64.zip", + "https://vsdebugger.blob.core.windows.net/coreclr-debug-1-22-2/coreclr-debug-linux-x64.zip" + ], + "sha256": "1lhyjq6g6lc1b4n4z57g0ssr5msqgsmrl8yli8j9ah5s3jq1lrda" + }, + "Razor-x86_64-linux": { + "installPath": ".razor", + "binaries": [ + "./rzls" + ], + "urls": [ + "https://download.visualstudio.microsoft.com/download/pr/757f5246-2b09-43fe-9a8d-840cfd15092b/2b6d8eee0470acf725c1c7a09f8b6475/razorlanguageserver-linux-x64-6.0.0-alpha.1.20418.9.zip", + "https://razorvscodetest.blob.core.windows.net/languageserver/RazorLanguageServer-linux-x64-6.0.0-alpha.1.20418.9.zip" + ], + "sha256": "1hksxq867anb9h040497phszq64f6krg4a46w0xqrm6crj8znqr5" + } +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/update-bin-srcs b/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/update-bin-srcs new file mode 100755 index 000000000000..ecd7efba05d8 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/update-bin-srcs @@ -0,0 +1,25 @@ +#!/usr/bin/env nix-shell +#!nix-shell -I nixpkgs=../../../.. -i bash -p curl jq unzip +set -euf -o pipefail + +declare scriptDir +scriptDir=$(cd "$(dirname "$0")"; pwd) +1>&2 echo "scriptDir='$scriptDir'" + +. "$scriptDir/update-bin-srcs-lib.sh" + +declare extPublisher="ms-dotnettools" +declare extName="csharp" +declare defaultExtVersion="1.23.2" +declare extVersion="${1:-$defaultExtVersion}" + +formatExtRuntimeDeps \ + "$extPublisher" "$extName" "$extVersion" \ + | computeAndAttachExtRtDepsChecksums \ + | jqStreamToJson \ + | tee "$scriptDir/rt-deps-bin-srcs.json" \ + | jq '.' + +# TODO: Unfortunatly no simple json to nix implementation available. +# This would allow us to dump to './rt-deps-bin-srcs.nix' instead. +# jsonToNix diff --git a/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/update-bin-srcs-lib.sh b/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/update-bin-srcs-lib.sh new file mode 100755 index 000000000000..ad494a37908a --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/ms-dotnettools-csharp/update-bin-srcs-lib.sh @@ -0,0 +1,154 @@ +#!/usr/bin/env bash + +prefetchExtensionZip() { + declare publisher="${1?}" + declare name="${2?}" + declare version="${3?}" + + 1>&2 echo + 1>&2 echo "------------- Downloading extension ---------------" + + declare extZipStoreName="${publisher}-${name}.zip" + declare extUrl="https://${publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/${publisher}/extension/${name}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage"; + 1>&2 echo "extUrl='$extUrl'" + declare nixPrefetchArgs=( --name "$extZipStoreName" --print-path "$extUrl" ) + + 1>&2 printf "$ nix-prefetch-url" + 1>&2 printf " %q" "${nixPrefetchArgs[@]}" + 1>&2 printf " 2> /dev/null\n" + declare zipShaWStorePath + zipShaWStorePath=$(nix-prefetch-url "${nixPrefetchArgs[@]}" 2> /dev/null) + + 1>&2 echo "zipShaWStorePath='$zipShaWStorePath'" + echo "$zipShaWStorePath" +} + + +prefetchExtensionUnpacked() { + declare publisher="${1?}" + declare name="${2?}" + declare version="${3?}" + + declare zipShaWStorePath + zipShaWStorePath="$(prefetchExtensionZip "$publisher" "$name" "$version")" + + declare zipStorePath + zipStorePath="$(echo "$zipShaWStorePath" | tail -n1)" + 1>&2 echo "zipStorePath='$zipStorePath'" + + function rm_tmpdir() { + 1>&2 printf "rm -rf -- %q\n" "$tmpDir" + rm -rf -- "$tmpDir" + unset tmpDir + trap - INT TERM HUP EXIT + } + function make_trapped_tmpdir() { + tmpDir=$(mktemp -d) + trap rm_tmpdir INT TERM HUP EXIT + } + + 1>&2 echo + 1>&2 echo "------------- Unpacking extension ---------------" + + make_trapped_tmpdir + declare unzipArgs=( -q -d "$tmpDir" "$zipStorePath" ) + 1>&2 printf "$ unzip" + 1>&2 printf " %q" "${unzipArgs[@]}" + 1>&2 printf "\n" + unzip "${unzipArgs[@]}" + + declare unpackedStoreName="${publisher}-${name}" + + declare unpackedStorePath + unpackedStorePath="$(nix add-to-store -n "$unpackedStoreName" "$tmpDir")" + declare unpackedSha256 + unpackedSha256="$(nix hash-path --base32 --type sha256 "$unpackedStorePath")" + 1>&2 echo "unpackedStorePath='$unpackedStorePath'" + 1>&2 echo "unpackedSha256='$unpackedSha256'" + + rm_tmpdir + + echo "$unpackedSha256" + echo "$unpackedStorePath" +} + + +prefetchExtensionJson() { + declare publisher="${1?}" + declare name="${2?}" + declare version="${3?}" + + declare unpackedShaWStorePath + unpackedShaWStorePath="$(prefetchExtensionUnpacked "$publisher" "$name" "$version")" + + declare unpackedStorePath + unpackedStorePath="$(echo "$unpackedShaWStorePath" | tail -n1)" + 1>&2 echo "unpackedStorePath='$unpackedStorePath'" + + declare jsonShaWStorePath + jsonShaWStorePath=$(nix-prefetch-url --print-path "file://${unpackedStorePath}/extension/package.json" 2> /dev/null) + + 1>&2 echo "jsonShaWStorePath='$jsonShaWStorePath'" + echo "$jsonShaWStorePath" +} + + +formatExtRuntimeDeps() { + declare publisher="${1?}" + declare name="${2?}" + declare version="${3?}" + + declare jsonShaWStorePath + jsonShaWStorePath="$(prefetchExtensionJson "$publisher" "$name" "$version")" + + declare jsonStorePath + jsonStorePath="$(echo "$jsonShaWStorePath" | tail -n1)" + 1>&2 echo "jsonStorePath='$jsonStorePath'" + + declare jqQuery + jqQuery=$(cat <<'EOF' +.runtimeDependencies \ +| map(select(.platforms[] | in({"linux": null}))) \ +| map(select(.architectures[] | in({"x86_64": null}))) \ +| .[] | {(.id + "-" + (.architectures[0]) + "-" + (.platforms[0])): \ +{installPath, binaries, urls: [.url, .fallbackUrl]}} +EOF +) + + 1>&2 printf "$ cat %q | jq '%s'\n" "$jsonStorePath" "$jqQuery" + cat "$jsonStorePath" | jq "$jqQuery" +} + + +computeExtRtDepChecksum() { + declare rtDepJsonObject="${1?}" + declare url + url="$(echo "$rtDepJsonObject" | jq -j '.[].urls[0]')" + declare sha256 + 1>&2 printf "$ nix-prefetch-url '%s'\n" "$url" + sha256="$(nix-prefetch-url "$url")" + 1>&2 echo "$sha256" + echo "$sha256" +} + + +computeAndAttachExtRtDepsChecksums() { + while read -r rtDepJsonObject; do + declare sha256 + sha256="$(computeExtRtDepChecksum "$rtDepJsonObject")" + echo "$rtDepJsonObject" | jq --arg sha256 "$sha256" '.[].sha256 = $sha256' + done < <(cat - | jq -c '.') +} + + +jqStreamToJson() { + cat - | jq --slurp '. | add' +} + + +jsonToNix() { + # TODO: Replacing this non functional stuff with a proper json to nix + # implementation would allow us to produce a 'rt-deps-bin-srcs.nix' file instead. + false + cat - | sed -E -e 's/": /" = /g' -e 's/,$/;/g' -e 's/ }$/ };/g' -e 's/ ]$/ ];/g' +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/ms-vsliveshare-vsliveshare/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/ms-vsliveshare-vsliveshare/default.nix new file mode 100644 index 000000000000..0fa9a4bb4bee --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/ms-vsliveshare-vsliveshare/default.nix @@ -0,0 +1,134 @@ +# Based on previous attempts: +# - <https://github.com/msteen/nixos-vsliveshare/blob/master/pkgs/vsliveshare/default.nix> +# - <https://github.com/NixOS/nixpkgs/issues/41189> +{ lib, gccStdenv, vscode-utils +, jq, autoPatchelfHook, bash, makeWrapper +, dotnet-sdk_3, curl, gcc, icu, libkrb5, libsecret, libunwind, libX11, lttng-ust, openssl, util-linux, zlib +, desktop-file-utils, xprop, xsel +}: + +with lib; + +let + # https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#install-prerequisites-manually + libs = [ + # .NET Core + openssl + libkrb5 + zlib + icu + + # 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.4498"; + sha256 = "01gg9jqkq9z05ckw0mnqfr769359j6h3z8ay6r17jj6m4mhy2m5g"; + }; +}).overrideAttrs({ nativeBuildInputs ? [], buildInputs ? [], ... }: { + nativeBuildInputs = nativeBuildInputs ++ [ + bash + jq + autoPatchelfHook + makeWrapper + ]; + 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 = '' + sed -i \ + -e 's/updateExecutablePermissionsAsync() {/& return;/' \ + -e 's/isInstallCorrupt(traceSource, manifest) {/& return false;/' \ + out/prod/extension-prod.js + + declare ext_unique_id + ext_unique_id="$(basename "$out")" + + # Fix extension attempting to write to 'modifiedInternalSettings.json'. + # Move this write to the tmp directory indexed by the nix store basename. + substituteInPlace out/prod/extension-prod.js \ + --replace "path.resolve(constants_1.EXTENSION_ROOT_PATH, './modifiedInternalSettings.json')" \ + "path.join(os.tmpdir(), '$ext_unique_id-modifiedInternalSettings.json')" + + # Fix extension attempting to write to 'vsls-agent.lock'. + # Move this write to the tmp directory indexed by the nix store basename. + substituteInPlace out/prod/extension-prod.js \ + --replace "path + '.lock'" \ + "__webpack_require__('path').join(__webpack_require__('os').tmpdir(), '$ext_unique_id-vsls-agent.lock')" + + # Hardcode executable paths + echo '#!/bin/sh' >node_modules/@vsliveshare/vscode-launcher-linux/check-reqs.sh + substituteInPlace node_modules/@vsliveshare/vscode-launcher-linux/install.sh \ + --replace desktop-file-install ${desktop-file-utils}/bin/desktop-file-install + substituteInPlace node_modules/@vsliveshare/vscode-launcher-linux/uninstall.sh \ + --replace update-desktop-database ${desktop-file-utils}/bin/update-desktop-database + substituteInPlace node_modules/@vsliveshare/vscode-launcher-linux/vsls-launcher \ + --replace /bin/bash ${bash}/bin/bash + substituteInPlace out/prod/extension-prod.js \ + --replace xprop ${xprop}/bin/xprop \ + --replace "'xsel'" "'${xsel}/bin/xsel'" + ''; + + postInstall = '' + cd $out/share/vscode/extensions/ms-vsliveshare.vsliveshare + + bash -s <<ENDSUBSHELL + shopt -s extglob + + # A workaround to prevent the journal filling up due to diagnostic logging. + # See: https://github.com/MicrosoftDocs/live-share/issues/1272 + # See: https://unix.stackexchange.com/questions/481799/how-to-prevent-a-process-from-writing-to-the-systemd-journal + gcc -fPIC -shared -ldl -o dotnet_modules/noop-syslog.so ${./noop-syslog.c} + + # Normally the copying of the right executables is done externally at a later time, + # but we want it done at installation time. + cp dotnet_modules/exes/linux-x64/* dotnet_modules + + # The required executables are already copied over, + # and the other runtimes won't be used and thus are just a waste of space. + rm -r dotnet_modules/exes dotnet_modules/runtimes/!(linux-x64|unix) + + # Not all executables and libraries are executable, so make sure that they are. + jq <package.json '.executables.linux[]' -r | xargs chmod +x + + # Lock the extension downloader. + touch install-linux.Lock externalDeps-linux.Lock + ENDSUBSHELL + ''; + + postFixup = '' + # We cannot use `wrapProgram`, because it will generate a relative path, + # which will break when copying over the files. + mv dotnet_modules/vsls-agent{,-wrapped} + makeWrapper $PWD/dotnet_modules/vsls-agent{-wrapped,} \ + --prefix LD_LIBRARY_PATH : "${makeLibraryPath libs}" \ + --set LD_PRELOAD $PWD/dotnet_modules/noop-syslog.so \ + --set DOTNET_ROOT ${dotnet-sdk_3} + ''; + + meta = { + 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/nixpkgs/pkgs/misc/vscode-extensions/ms-vsliveshare-vsliveshare/noop-syslog.c b/nixpkgs/pkgs/misc/vscode-extensions/ms-vsliveshare-vsliveshare/noop-syslog.c new file mode 100644 index 000000000000..c76ec57a3820 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/ms-vsliveshare-vsliveshare/noop-syslog.c @@ -0,0 +1 @@ +void syslog(int priority, const char *format, ...) { } diff --git a/nixpkgs/pkgs/misc/vscode-extensions/python/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/python/default.nix new file mode 100644 index 000000000000..89950a51598c --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/python/default.nix @@ -0,0 +1,93 @@ +{ lib, stdenv, fetchurl, vscode-utils, extractNuGet +, icu, curl, openssl, lttng-ust, autoPatchelfHook +, python3, musl +, pythonUseFixed ? false # 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. +, ctagsUseFixed ? true, ctags # When `true`, the ctags default setting will be fixed to specified. + # Use version from `PATH` for default setting otherwise. + # Defaults to `true` as usually not defined on a per projet basis. +}: + +assert ctagsUseFixed -> null != ctags; + +let + pythonDefaultsTo = if pythonUseFixed then "${python3}/bin/python" else "python"; + ctagsDefaultsTo = if ctagsUseFixed then "${ctags}/bin/ctags" else "ctags"; + + # The arch tag comes from 'PlatformName' defined here: + # https://github.com/Microsoft/vscode-python/blob/master/src/client/activation/types.ts + arch = + if stdenv.isLinux && stdenv.isx86_64 then "linux-x64" + else if stdenv.isDarwin then "osx-x64" + else throw "Only x86_64 Linux and Darwin are supported."; + + languageServerSha256 = { + linux-x64 = "1pmj5pb4xylx4gdx4zgmisn0si59qx51n2m1bh7clv29q6biw05n"; + osx-x64 = "0ishiy1z9dghj4ryh95vy8rw0v7q4birdga2zdb4a8am31wmp94b"; + }.${arch}; + + # version is languageServerVersion in the package.json + languageServer = extractNuGet rec { + name = "Python-Language-Server"; + version = "0.5.30"; + + src = fetchurl { + url = "https://pvsc.azureedge.net/python-language-server-stable/${name}-${arch}.${version}.nupkg"; + sha256 = languageServerSha256; + }; + }; +in vscode-utils.buildVscodeMarketplaceExtension rec { + mktplcRef = { + name = "python"; + publisher = "ms-python"; + version = "2021.5.829140558"; + }; + + vsix = fetchurl { + name = "${mktplcRef.publisher}-${mktplcRef.name}.zip"; + url = "https://github.com/microsoft/vscode-python/releases/download/${mktplcRef.version}/ms-python-release.vsix"; + sha256 = "0y2HN4WGYUUXBfqp8Xb4oaA0hbLZmE3kDUXMBAOjvPQ="; + }; + + buildInputs = [ + icu + curl + openssl + lttng-ust + musl + ]; + + nativeBuildInputs = [ + autoPatchelfHook + python3.pkgs.wrapPython + ]; + + pythonPath = with python3.pkgs; [ + setuptools + ]; + + postPatch = '' + # Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`. + substituteInPlace "./package.json" \ + --replace "\"default\": \"python\"" "\"default\": \"${pythonDefaultsTo}\"" + + # Patch `packages.json` so that nix's *ctags* is used as default value for `python.workspaceSymbols.ctagsPath`. + substituteInPlace "./package.json" \ + --replace "\"default\": \"ctags\"" "\"default\": \"${ctagsDefaultsTo}\"" + ''; + + postInstall = '' + mkdir -p "$out/$installPrefix/languageServer.${languageServer.version}" + cp -R --no-preserve=ownership ${languageServer}/* "$out/$installPrefix/languageServer.${languageServer.version}" + chmod -R +wx "$out/$installPrefix/languageServer.${languageServer.version}" + + patchPythonScript "$out/$installPrefix/pythonFiles/lib/python/isort/main.py" + ''; + + meta = with lib; { + license = licenses.mit; + platforms = [ "x86_64-linux" ]; + maintainers = [ maintainers.jraygauthier ]; + }; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/python/extract-nuget.nix b/nixpkgs/pkgs/misc/vscode-extensions/python/extract-nuget.nix new file mode 100644 index 000000000000..1e70cabe0358 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/python/extract-nuget.nix @@ -0,0 +1,15 @@ +{ stdenv, unzip }: +{ name, version, src, ... }: + +stdenv.mkDerivation { + inherit name version src; + + nativeBuildInputs = [ unzip ]; + dontBuild = true; + unpackPhase = "unzip $src"; + installPhase = '' + mkdir -p "$out" + chmod -R +w . + find . -mindepth 1 -maxdepth 1 | xargs cp -a -t "$out" + ''; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/remote-ssh/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/remote-ssh/default.nix new file mode 100644 index 000000000000..29ca973a0aae --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/remote-ssh/default.nix @@ -0,0 +1,55 @@ +{ 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; + + # patch runs on remote machine hence use of which + # links to local node if version is 12 + patch = '' + f="$HOME/.vscode-server/bin/$COMMIT_ID/node" + localNodePath=''$(which node) + if [ -x "''$localNodePath" ]; then + localNodeVersion=''$(node -v) + if [ "\''${localNodeVersion:1:2}" = "12" ]; then + echo PATCH: replacing ''$f with ''$localNodePath + rm ''$f + ln -s ''$localNodePath ''$f + fi + fi + ${lib.optionalString useLocalExtensions '' + # Use local extensions + if [ -d $HOME/.vscode/extensions ]; then + if ! test -L "$HOME/.vscode-server/extensions"; then + mkdir -p $HOME/.vscode-server + ln -s $HOME/.vscode/extensions $HOME/.vscode-server/ + fi + fi + ''} + ''; +in + buildVscodeMarketplaceExtension { + mktplcRef = { + name = "remote-ssh"; + publisher = "ms-vscode-remote"; + version = "0.50.0"; + sha256 = "01pyd6759p5nkjhjy3iplrl748xblr54l1jphk2g02s1n5ds2qb9"; + }; + + postPatch = '' + substituteInPlace "out/extension.js" \ + --replace "# install extensions" '${patch}' + ''; + + meta = with lib; { + description ="Use any remote machine with a SSH server as your development environment."; + license = licenses.unfree; + maintainers = with maintainers; [ + tbenst + ]; + }; + } diff --git a/nixpkgs/pkgs/misc/vscode-extensions/rust-analyzer/build-deps/package.json b/nixpkgs/pkgs/misc/vscode-extensions/rust-analyzer/build-deps/package.json new file mode 100644 index 000000000000..d54ad42b1f6d --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/rust-analyzer/build-deps/package.json @@ -0,0 +1,27 @@ +{ + "name": "rust-analyzer", + "version": "0.4.0-dev", + "dependencies": { + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.1", + "vscode-languageclient": "^7.1.0-next.5", + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-node-resolve": "^11.0.0", + "@types/glob": "^7.1.3", + "@types/mocha": "^8.0.4", + "@types/node": "~12.12.6", + "@types/node-fetch": "^2.5.7", + "@types/vscode": "^1.53.0", + "@typescript-eslint/eslint-plugin": "^4.9.0", + "@typescript-eslint/parser": "^4.9.0", + "eslint": "^7.15.0", + "glob": "^7.1.6", + "mocha": "^8.2.1", + "rollup": "^2.34.2", + "tslib": "^2.0.3", + "typescript": "^4.1.2", + "typescript-formatter": "^7.2.2", + "vsce": "=1.88.0", + "vscode-test": "^1.5.1" + } +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/rust-analyzer/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/rust-analyzer/default.nix new file mode 100644 index 000000000000..0136bf4e5b1b --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/rust-analyzer/default.nix @@ -0,0 +1,49 @@ +# Update script: pkgs/development/tools/rust/rust-analyzer/update.sh +{ lib, vscode-utils, jq, rust-analyzer, nodePackages +, setDefaultServerPath ? true +}: + +let + pname = "rust-analyzer"; + publisher = "matklad"; + + # Follow the unstable version of rust-analyzer, since the extension is not stable yet. + inherit (rust-analyzer) version; + + build-deps = nodePackages."rust-analyzer-build-deps-../../misc/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 = "${rust-analyzer.src}/editors/code"; + outputs = [ "vsix" "out" ]; + + postInstall = '' + npm run package + mkdir $vsix + cp ${pname}.vsix $vsix/${pname}.zip + ''; + }; + +in vscode-utils.buildVscodeExtension { + inherit version vsix; + name = "${pname}-${version}"; + src = "${vsix}/${pname}.zip"; + vscodeExtUniqueId = "${publisher}.${pname}"; + + nativeBuildInputs = lib.optional setDefaultServerPath jq; + + preInstall = lib.optionalString setDefaultServerPath '' + jq '.contributes.configuration.properties."rust-analyzer.serverPath".default = $s' \ + --arg s "${rust-analyzer}/bin/rust-analyzer" \ + package.json >package.json.new + mv package.json.new package.json + ''; + + meta = with lib; { + description = "An alternative rust language server to the RLS"; + homepage = "https://github.com/rust-analyzer/rust-analyzer"; + license = with licenses; [ mit asl20 ]; + maintainers = with maintainers; [ oxalica ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/terraform/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/terraform/default.nix new file mode 100644 index 000000000000..658495296bf6 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/terraform/default.nix @@ -0,0 +1,25 @@ +{ lib, fetchurl, vscode-utils, terraform-ls }: +vscode-utils.buildVscodeMarketplaceExtension rec { + mktplcRef = { + name = "terraform"; + publisher = "hashicorp"; + version = "2.13.0"; + }; + + vsix = fetchurl { + name = "${mktplcRef.publisher}-${mktplcRef.name}.zip"; + url = "https://github.com/hashicorp/vscode-terraform/releases/download/v${mktplcRef.version}/${mktplcRef.name}-${mktplcRef.version}.vsix"; + sha256 = "1wc4jl4h3ja4ivynf20yxzwqssi6yd7alvqvcjrkksic98480qcz"; + }; + + patches = [ ./fix-terraform-ls.patch ]; + + postPatch = '' + substituteInPlace out/extension.js --replace TERRAFORM-LS-PATH ${terraform-ls}/bin/terraform-ls + ''; + + meta = with lib; { + license = licenses.mit; + maintainers = with maintainers; [ rhoriguchi ]; + }; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/terraform/fix-terraform-ls.patch b/nixpkgs/pkgs/misc/vscode-extensions/terraform/fix-terraform-ls.patch new file mode 100644 index 000000000000..95e8d92da332 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/terraform/fix-terraform-ls.patch @@ -0,0 +1,39 @@ +diff --git a/out/extension.js b/out/extension.js +index e932d27..099126b 100644 +--- a/out/extension.js ++++ b/out/extension.js +@@ -143,25 +143,6 @@ function updateLanguageServer() { + return __awaiter(this, void 0, void 0, function* () { + const delay = 1000 * 60 * 60 * 24; + languageServerUpdater.timeout(updateLanguageServer, delay); // check for new updates every 24hrs +- // skip install if a language server binary path is set +- if (!vscodeUtils_1.config('terraform').get('languageServer.pathToBinary')) { +- const installer = new languageServerInstaller_1.LanguageServerInstaller(installPath, reporter); +- const install = yield installer.needsInstall(); +- if (install) { +- yield stopClients(); +- try { +- yield installer.install(); +- } +- catch (err) { +- console.log(err); // for test failure reporting +- reporter.sendTelemetryException(err); +- throw err; +- } +- finally { +- yield installer.cleanupZips(); +- } +- } +- } + return startClients(); // on repeat runs with no install, this will be a no-op + }); + } +@@ -259,7 +240,7 @@ function pathToBinary() { + reporter.sendTelemetryEvent('usePathToBinary'); + } + else { +- command = path.join(installPath, 'terraform-ls'); ++ command = 'TERRAFORM-LS-PATH'; + } + _pathToBinaryPromise = Promise.resolve(command); + } diff --git a/nixpkgs/pkgs/misc/vscode-extensions/updateSettings.nix b/nixpkgs/pkgs/misc/vscode-extensions/updateSettings.nix new file mode 100644 index 000000000000..c7fecf080720 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/updateSettings.nix @@ -0,0 +1,39 @@ +# Updates the vscode setting file base on a nix expression +# should run from the workspace root. +{ writeShellScriptBin +, lib +, jq +}: +##User Input +{ settings ? {} +# if marked as true will create an empty json file if does not exists +, createIfDoesNotExists ? true +, vscodeSettingsFile ? ".vscode/settings.json" +, userSettingsFolder ? "" +, symlinkFromUserSetting ? false +}: +let + + updateVSCodeSettingsCmd = '' + ( + echo 'updateSettings.nix: Updating ${vscodeSettingsFile}...' + oldSettings=$(cat ${vscodeSettingsFile}) + echo $oldSettings' ${builtins.toJSON settings}' | ${jq}/bin/jq -s add > ${vscodeSettingsFile} + )''; + + createEmptySettingsCmd = ''mkdir -p .vscode && echo "{}" > ${vscodeSettingsFile}''; + fileName = builtins.baseNameOf vscodeSettingsFile; + symlinkFromUserSettingCmd = lib.optionalString symlinkFromUserSetting + '' && mkdir -p "${userSettingsFolder}" && ln -sfv "$(pwd)/${vscodeSettingsFile}" "${userSettingsFolder}/" ''; +in + + writeShellScriptBin ''vscodeNixUpdate-${lib.removeSuffix ".json" (fileName)}'' + (lib.optionalString (settings != {}) + (if createIfDoesNotExists then '' + [ ! -f "${vscodeSettingsFile}" ] && ${createEmptySettingsCmd} + ${updateVSCodeSettingsCmd} ${symlinkFromUserSettingCmd} + '' + else ''[ -f "${vscodeSettingsFile}" ] && ${updateVSCodeSettingsCmd} ${symlinkFromUserSettingCmd} + '' + ) + ) diff --git a/nixpkgs/pkgs/misc/vscode-extensions/updateSettingsTest.nix b/nixpkgs/pkgs/misc/vscode-extensions/updateSettingsTest.nix new file mode 100644 index 000000000000..097b9cad1661 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/updateSettingsTest.nix @@ -0,0 +1,6 @@ +with import <nixpkgs>{}; +callPackage (import ./updateSettings.nix) {} { + settings = { + a = "fdsdf"; + }; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/update_installed_exts.sh b/nixpkgs/pkgs/misc/vscode-extensions/update_installed_exts.sh new file mode 100755 index 000000000000..659ed8da791e --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/update_installed_exts.sh @@ -0,0 +1,74 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p curl jq unzip +set -eu -o pipefail + +# Helper to just fail with a message and non-zero exit code. +function fail() { + echo "$1" >&2 + exit 1 +} + +# Helper to clean up after ourselves if we're killed by SIGINT. +function clean_up() { + TDIR="${TMPDIR:-/tmp}" + echo "Script killed, cleaning up tmpdirs: $TDIR/vscode_exts_*" >&2 + rm -Rf "$TDIR/vscode_exts_*" +} + +function get_vsixpkg() { + N="$1.$2" + + # Create a tempdir for the extension download. + EXTTMP=$(mktemp -d -t vscode_exts_XXXXXXXX) + + URL="https://$1.gallery.vsassets.io/_apis/public/gallery/publisher/$1/extension/$2/latest/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage" + + # Quietly but delicately curl down the file, blowing up at the first sign of trouble. + curl --silent --show-error --fail -X GET -o "$EXTTMP/$N.zip" "$URL" + # Unpack the file we need to stdout then pull out the version + VER=$(jq -r '.version' <(unzip -qc "$EXTTMP/$N.zip" "extension/package.json")) + # Calculate the SHA + SHA=$(nix-hash --flat --base32 --type sha256 "$EXTTMP/$N.zip") + + # Clean up. + rm -Rf "$EXTTMP" + # I don't like 'rm -Rf' lurking in my scripts but this seems appropriate. + + cat <<-EOF + { + name = "$2"; + publisher = "$1"; + version = "$VER"; + sha256 = "$SHA"; + } +EOF +} + +# See if we can find our `code` binary somewhere. +if [ $# -ne 0 ]; then + CODE=$1 +else + CODE=$(command -v code) +fi + +if [ -z "$CODE" ]; then + # Not much point continuing. + fail "VSCode executable not found" +fi + +# Try to be a good citizen and clean up after ourselves if we're killed. +trap clean_up SIGINT + +# Begin the printing of the nix expression that will house the list of extensions. +printf '{ extensions = [\n' + +# Note that we are only looking to update extensions that are already installed. +for i in $($CODE --list-extensions) +do + OWNER=$(echo "$i" | cut -d. -f1) + EXT=$(echo "$i" | cut -d. -f2) + + get_vsixpkg "$OWNER" "$EXT" +done +# Close off the nix expression. +printf '];\n}' diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/build-deps/package.json b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/build-deps/package.json new file mode 100644 index 000000000000..86d7b1aa6fa4 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/build-deps/package.json @@ -0,0 +1,23 @@ +{ + "name": "vscode-lldb", + "version": "1.6.5", + "dependencies": { + "string-argv": "^0.3.1", + "yaml": "^1.10.0", + "yauzl": "^2.10.0", + "@types/vscode": "^1.31.0", + "@types/node": "^8.10.50", + "@types/mocha": "^7.0.1", + "@types/yauzl": "^2.9.0", + "typescript": "^4.2.4", + "mocha": "^8.4.0", + "source-map-support": "^0.5.12", + "memory-streams": "^0.1.3", + "vscode-debugprotocol": "^1.47.0", + "vscode-debugadapter-testsupport": "^1.47.0", + "vsce": "=1.88.0", + "webpack": "^5.37.1", + "webpack-cli": "^4.7.0", + "ts-loader": "^8.0.0" + } +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/cmake-build-extension-only.patch b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/cmake-build-extension-only.patch new file mode 100644 index 000000000000..fb55816b942c --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/cmake-build-extension-only.patch @@ -0,0 +1,36 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 37745b5..cad11a0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -16,13 +16,6 @@ endif() + set(VERSION "${VERSION}${VERSION_SUFFIX}") + message("Version ${VERSION}") + +-set(LLDB_PACKAGE $ENV{LLDB_PACKAGE} CACHE PATH "Zip archive containing LLDB files") +-if (LLDB_PACKAGE) +- message("Using LLDB_PACKAGE=${LLDB_PACKAGE}") +-else() +- message(FATAL_ERROR "LLDB_PACKAGE not set." ) +-endif() +- + set(TEST_TIMEOUT 5000 CACHE STRING "Test timeout [ms]") + + # General OS-specific definitions +@@ -87,16 +80,6 @@ configure_file(package.json ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY) + configure_file(webpack.config.js ${CMAKE_CURRENT_BINARY_DIR}/webpack.config.js @ONLY) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/package-lock.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +-# Run 'npm install' +-execute_process( +- COMMAND ${NPM} ci # like install, but actually respects package-lock file. +- WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +- RESULT_VARIABLE Result +-) +-if (NOT ${Result} EQUAL 0) +- message(FATAL_ERROR "npm intall failed: ${Result}") +-endif() +- + # Copy it back, so we can commit the lock file. + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/package-lock.json DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}) + + diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/default.nix new file mode 100644 index 000000000000..0ef98818dbd1 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/default.nix @@ -0,0 +1,104 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, callPackage +, nodePackages, cmake, nodejs, unzip, python3 +}: +assert lib.versionAtLeast python3.version "3.5"; +let + publisher = "vadimcn"; + pname = "vscode-lldb"; + version = "1.6.5"; + + vscodeExtUniqueId = "${publisher}.${pname}"; + + src = fetchFromGitHub { + owner = "vadimcn"; + repo = "vscode-lldb"; + rev = "v${version}"; + sha256 = "sha256-ppiEWFKJiUtlF8LSqBb8Xvg26B+wHcIZJhU+ANE4J2k="; + }; + + lldb = callPackage ./lldb.nix {}; + + adapter = rustPlatform.buildRustPackage { + pname = "${pname}-adapter"; + inherit version src; + + # It will pollute the build environment of `buildRustPackage`. + cargoPatches = [ ./reset-cargo-config.patch ]; + + cargoSha256 = "sha256-ksRFlbtrFAbcX/Pc6rgWUHVl859GVUOvNckxM7Q971U="; + + nativeBuildInputs = [ makeWrapper ]; + + buildAndTestSubdir = "adapter"; + + cargoFlags = [ + "--lib" + "--bin=codelldb" + "--features=weak-linkage" + ]; + + # Tests are linked to liblldb but it is not available here. + doCheck = false; + }; + + nodeDeps = nodePackages."vscode-lldb-build-deps-../../misc/vscode-extensions/vscode-lldb/build-deps"; + +in stdenv.mkDerivation { + pname = "vscode-extension-${publisher}-${pname}"; + inherit src version vscodeExtUniqueId; + + installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}"; + + nativeBuildInputs = [ cmake nodejs unzip makeWrapper ]; + + patches = [ ./cmake-build-extension-only.patch ]; + + postConfigure = '' + cp -r ${nodeDeps}/lib/node_modules/vscode-lldb/{node_modules,package-lock.json} . + ''; + + cmakeFlags = [ + # Do not append timestamp to version. + "-DVERSION_SUFFIX=" + ]; + makeFlags = [ "vsix_bootstrap" ]; + + installPhase = '' + ext=$out/$installPrefix + runHook preInstall + + unzip ./codelldb-bootstrap.vsix 'extension/*' -d ./vsix-extracted + + mkdir -p $ext/{adapter,formatters} + mv -t $ext vsix-extracted/extension/* + cp -t $ext/adapter ${adapter}/{bin,lib}/* ../adapter/*.py + wrapProgram $ext/adapter/codelldb \ + --set-default LLDB_DEBUGSERVER_PATH "${lldb.out}/bin/lldb-server" + cp -t $ext/formatters ../formatters/*.py + ln -s ${lldb.lib} $ext/lldb + # Mark that all components are installed. + touch $ext/platform.ok + + runHook postInstall + ''; + + # `adapter` will find python binary and libraries at runtime. + postFixup = '' + wrapProgram $out/$installPrefix/adapter/codelldb \ + --prefix PATH : "${python3}/bin" \ + --prefix LD_LIBRARY_PATH : "${python3}/lib" + ''; + + passthru = { + inherit lldb adapter; + }; + + meta = with lib; { + description = "A native debugger extension for VSCode based on LLDB"; + homepage = "https://github.com/vadimcn/vscode-lldb"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ oxalica ]; + platforms = platforms.all; + broken = stdenv.isDarwin; # Build failed on x86_64-darwin currently. + }; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/lldb.nix b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/lldb.nix new file mode 100644 index 000000000000..e04e9ad0b5b5 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/lldb.nix @@ -0,0 +1,23 @@ +# Patched lldb for Rust language support. +{ lldb_12, fetchFromGitHub }: +let + llvmSrc = fetchFromGitHub { + owner = "vadimcn"; + repo = "llvm-project"; + rev = "f2e9ff34256cd8c6feaf14359f88ad3f538ed687"; + sha256 = "sha256-5UsCBu3rtt+l2HZiCswoQJPPh8T6y471TBF4AypdF9I="; + }; +in lldb_12.overrideAttrs (oldAttrs: { + src = "${llvmSrc}/lldb"; + + passthru = (oldAttrs.passthru or {}) // { + inherit llvmSrc; + }; + + doInstallCheck = true; + postInstallCheck = (oldAttrs.postInstallCheck or "") + '' + versionOutput="$($out/bin/lldb --version)" + echo "'lldb --version' returns: $versionOutput" + echo "$versionOutput" | grep -q 'rust-enabled' + ''; +}) diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/reset-cargo-config.patch b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/reset-cargo-config.patch new file mode 100644 index 000000000000..e95df0a9cef9 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/reset-cargo-config.patch @@ -0,0 +1,19 @@ +diff --git a/.cargo/config b/.cargo/config +index c3c75e4..e69de29 100644 +--- a/.cargo/config ++++ b/.cargo/config +@@ -1,14 +0,0 @@ +-[build] +-target-dir = "build/target" +- +-[target.armv7-unknown-linux-gnueabihf] +-rustflags = [ +- "-C", "link-arg=-fuse-ld=lld", +- "-C", "link-arg=--target=armv7-unknown-linux-gnueabihf", +-] +- +-[target.aarch64-unknown-linux-gnu] +-rustflags = [ +- "-C", "link-arg=-fuse-ld=lld", +- "-C", "link-arg=--target=aarch64-unknown-linux-gnu", +-] diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/update.sh b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/update.sh new file mode 100755 index 000000000000..8511ea3b12ed --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscode-lldb/update.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p jq nix-prefetch +set -eo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" +if [[ $# -ne 1 ]]; then + echo "Usage: ./update.sh <version>" + exit 1 +fi + +echo " +FIXME: This script doesn't update patched lldb. Please manually check branches +of https://github.com/vadimcn/llvm-project and update lldb with correct version of LLVM. +" + +nixpkgs=../../../.. +nixFile=./default.nix +owner=vadimcn +repo=vscode-lldb +version="$1" + +sed -E 's/\bversion = ".*?"/version = "'$version'"/' --in-place "$nixFile" +srcHash=$(nix-prefetch fetchFromGitHub --owner vadimcn --repo vscode-lldb --rev "v$version" --fetchSubmodules) +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" + +src="$(nix-build $nixpkgs -A vscode-extensions.vadimcn.vscode-lldb.src --no-out-link)" +jq '{ name, version: $version, dependencies: (.dependencies + .devDependencies) }' \ + --arg version "$version" \ + "$src/package.json" \ + > build-deps/package.json + +# FIXME: vsce@1.93.0 breaks the build. +sed 's/"vsce": ".*"/"vsce": "=1.88.0"/' --in-place build-deps/package.json + +# Regenerate nodePackages. +cd "$nixpkgs/pkgs/development/node-packages" +exec ./generate.sh diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscode-utils.nix b/nixpkgs/pkgs/misc/vscode-extensions/vscode-utils.nix new file mode 100644 index 000000000000..1de3bce3d0db --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscode-utils.nix @@ -0,0 +1,94 @@ +{ stdenv, lib, buildEnv, writeShellScriptBin, fetchurl, vscode, unzip, jq }: +let + buildVscodeExtension = a@{ + name, + src, + # Same as "Unique Identifier" on the extension's web page. + # For the moment, only serve as unique extension dir. + vscodeExtUniqueId, + configurePhase ? ":", + buildPhase ? ":", + dontPatchELF ? true, + dontStrip ? true, + buildInputs ? [], + ... + }: + stdenv.mkDerivation ((removeAttrs a [ "vscodeExtUniqueId" ]) // { + + name = "vscode-extension-${name}"; + + inherit vscodeExtUniqueId; + inherit configurePhase buildPhase dontPatchELF dontStrip; + + installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}"; + + buildInputs = [ unzip ] ++ buildInputs; + + installPhase = '' + + runHook preInstall + + mkdir -p "$out/$installPrefix" + find . -mindepth 1 -maxdepth 1 | xargs -d'\n' mv -t "$out/$installPrefix/" + + runHook postInstall + ''; + + }); + + fetchVsixFromVscodeMarketplace = mktplcExtRef: + fetchurl((import ./mktplcExtRefToFetchArgs.nix mktplcExtRef)); + + buildVscodeMarketplaceExtension = a@{ + name ? "", + src ? null, + vsix ? null, + mktplcRef, + ... + }: assert "" == name; assert null == src; + buildVscodeExtension ((removeAttrs a [ "mktplcRef" "vsix" ]) // { + name = "${mktplcRef.publisher}-${mktplcRef.name}-${mktplcRef.version}"; + src = if (vsix != null) + then vsix + else fetchVsixFromVscodeMarketplace mktplcRef; + vscodeExtUniqueId = "${mktplcRef.publisher}.${mktplcRef.name}"; + }); + + mktplcRefAttrList = [ + "name" + "publisher" + "version" + "sha256" + ]; + + mktplcExtRefToExtDrv = ext: + buildVscodeMarketplaceExtension ((removeAttrs ext mktplcRefAttrList) // { + mktplcRef = ext; + }); + + extensionFromVscodeMarketplace = mktplcExtRefToExtDrv; + extensionsFromVscodeMarketplace = mktplcExtRefList: + builtins.map extensionFromVscodeMarketplace mktplcExtRefList; + + vscodeWithConfiguration = import ./vscodeWithConfiguration.nix { + inherit lib extensionsFromVscodeMarketplace writeShellScriptBin; + vscodeDefault = vscode; + }; + + + vscodeExts2nix = import ./vscodeExts2nix.nix { + inherit lib writeShellScriptBin; + vscodeDefault = vscode; + }; + + vscodeEnv = import ./vscodeEnv.nix { + inherit lib buildEnv writeShellScriptBin extensionsFromVscodeMarketplace jq; + vscodeDefault = vscode; + }; +in +{ + inherit fetchVsixFromVscodeMarketplace buildVscodeExtension + buildVscodeMarketplaceExtension extensionFromVscodeMarketplace + extensionsFromVscodeMarketplace + vscodeWithConfiguration vscodeExts2nix vscodeEnv; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscodeEnv.nix b/nixpkgs/pkgs/misc/vscode-extensions/vscodeEnv.nix new file mode 100644 index 000000000000..7c58a4bdfb34 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscodeEnv.nix @@ -0,0 +1,86 @@ +#Use vscodeWithConfiguration and vscodeExts2nix to create a vscode executable. When the executable exits, it updates the mutable extension file, which is imported when evaluated by Nix later. +{ lib +, buildEnv +, writeShellScriptBin +, extensionsFromVscodeMarketplace +, vscodeDefault +, jq +}: +##User input +{ vscode ? vscodeDefault +, nixExtensions ? [] +, vscodeExtsFolderName ? ".vscode-exts" +# will add to the command updateSettings (which will run on executing vscode) settings to override in settings.json file +, settings ? {} +, createSettingsIfDoesNotExists ? true +, launch ? {} +, createLaunchIfDoesNotExists ? true +# will add to the command updateKeybindings(which will run on executing vscode) keybindings to override in keybinding.json file +, keybindings ? {} +, createKeybindingsIfDoesNotExists ? true +, user-data-dir ? ''"''${TMP}''${name}"/vscode-data-dir'' +# if file exists will use it and import the extensions in it into this dervation else will use empty extensions list +# this file will be created/updated by vscodeExts2nix when vscode exists +, mutableExtensionsFile +}: +let + mutableExtensionsFilePath = toString mutableExtensionsFile; + mutableExtensions = if builtins.pathExists mutableExtensionsFile + then import mutableExtensionsFilePath else []; + vscodeWithConfiguration = import ./vscodeWithConfiguration.nix { + inherit lib writeShellScriptBin extensionsFromVscodeMarketplace; + vscodeDefault = vscode; + } + { + inherit nixExtensions mutableExtensions vscodeExtsFolderName user-data-dir; + }; + + updateSettings = import ./updateSettings.nix { inherit lib writeShellScriptBin jq; }; + userSettingsFolder = "${ user-data-dir }/User"; + + updateSettingsCmd = updateSettings { + settings = { + "extensions.autoCheckUpdates" = false; + "extensions.autoUpdate" = false; + "update.mode" = "none"; + } // settings; + inherit userSettingsFolder; + createIfDoesNotExists = createSettingsIfDoesNotExists; + symlinkFromUserSetting = (user-data-dir != ""); + }; + + updateLaunchCmd = updateSettings { + settings = launch; + createIfDoesNotExists = createLaunchIfDoesNotExists; + vscodeSettingsFile = ".vscode/launch.json"; + }; + + updateKeybindingsCmd = updateSettings { + settings = keybindings; + createIfDoesNotExists = createKeybindingsIfDoesNotExists; + vscodeSettingsFile = ".vscode/keybindings.json"; + inherit userSettingsFolder; + symlinkFromUserSetting = (user-data-dir != ""); + }; + + vscodeExts2nix = import ./vscodeExts2nix.nix { + inherit lib writeShellScriptBin; + vscodeDefault = vscodeWithConfiguration; + } + { + extensionsToIgnore = nixExtensions; + extensions = mutableExtensions; + }; + code = writeShellScriptBin "code" '' + ${updateSettingsCmd}/bin/vscodeNixUpdate-settings + ${updateLaunchCmd}/bin/vscodeNixUpdate-launch + ${updateKeybindingsCmd}/bin/vscodeNixUpdate-keybindings + ${vscodeWithConfiguration}/bin/code --wait "$@" + echo 'running vscodeExts2nix to update ${mutableExtensionsFilePath}...' + ${vscodeExts2nix}/bin/vscodeExts2nix > ${mutableExtensionsFilePath} + ''; +in +buildEnv { + name = "vscodeEnv"; + paths = [ code vscodeExts2nix updateSettingsCmd updateLaunchCmd updateKeybindingsCmd ]; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscodeEnvTest.nix b/nixpkgs/pkgs/misc/vscode-extensions/vscodeEnvTest.nix new file mode 100644 index 000000000000..19a9edbf1afe --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscodeEnvTest.nix @@ -0,0 +1,11 @@ +with import <nixpkgs>{}; +callPackage (import ./vscodeEnv.nix) { + extensionsFromVscodeMarketplace = vscode-utils.extensionsFromVscodeMarketplace; + vscodeDefault = vscode; +} { + mutableExtensionsFile = ./extensions.nix; + settings = { + a = "fdsdf"; + t = "test"; + }; +} diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscodeExts2nix.nix b/nixpkgs/pkgs/misc/vscode-extensions/vscodeExts2nix.nix new file mode 100644 index 000000000000..58cbe663c901 --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscodeExts2nix.nix @@ -0,0 +1,44 @@ +# based on the passed vscode will stdout a nix expression with the installed vscode extensions +{ lib +, vscodeDefault +, writeShellScriptBin +}: + +##User input +{ vscode ? vscodeDefault +, extensionsToIgnore ? [] +# will use those extensions to get sha256 if still exists when executed. +, extensions ? [] +}: +let + mktplcExtRefToFetchArgs = import ./mktplcExtRefToFetchArgs.nix; +in +writeShellScriptBin "vscodeExts2nix" '' + echo '[' + + for line in $(${vscode}/bin/code --list-extensions --show-versions \ + ${lib.optionalString (extensionsToIgnore != []) '' + | grep -v -i '^\(${lib.concatMapStringsSep "\\|" (e : "${e.publisher}.${e.name}") extensionsToIgnore}\)' + ''} + ) ; do + [[ $line =~ ([^.]*)\.([^@]*)@(.*) ]] + name=''${BASH_REMATCH[2]} + publisher=''${BASH_REMATCH[1]} + version=''${BASH_REMATCH[3]} + + extensions="${lib.concatMapStringsSep "." (e : "${e.publisher}${e.name}@${e.sha256}") extensions}" + reCurrentExt=$publisher$name"@([^.]*)" + if [[ $extensions =~ $reCurrentExt ]]; then + sha256=''${BASH_REMATCH[1]} + else + sha256=$( + nix-prefetch-url "${(mktplcExtRefToFetchArgs {publisher = ''"$publisher"''; name = ''"$name"''; version = ''"$version"'';}).url}" 2> /dev/null + ) + fi + + echo "{ name = \"''${name}\"; publisher = \"''${publisher}\"; version = \"''${version}\"; sha256 = \"''${sha256}\"; }" + done + + + echo ']' +'' diff --git a/nixpkgs/pkgs/misc/vscode-extensions/vscodeWithConfiguration.nix b/nixpkgs/pkgs/misc/vscode-extensions/vscodeWithConfiguration.nix new file mode 100644 index 000000000000..39479d7c2f2c --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/vscodeWithConfiguration.nix @@ -0,0 +1,54 @@ +# wrapper over vscode to control extensions per project (extensions folder will be created in execution path) +{ lib +, writeShellScriptBin +, extensionsFromVscodeMarketplace +, vscodeDefault +}: +## User input +{ vscode ? vscodeDefault +# extensions to be symlinked into the project's extensions folder +, nixExtensions ? [] +# extensions to be copied into the project's extensions folder +, mutableExtensions ? [] +, vscodeExtsFolderName ? ".vscode-exts" +, user-data-dir ? ''"''${TMP}vscodeWithConfiguration/vscode-data-dir"'' +}: +let + nixExtsDrvs = extensionsFromVscodeMarketplace nixExtensions; + mutExtsDrvs = extensionsFromVscodeMarketplace mutableExtensions; + mutableExtsPaths = lib.forEach mutExtsDrvs ( e: + { + origin = "${e}/share/vscode/extensions/${e.vscodeExtUniqueId}"; + target = ''${vscodeExtsFolderName}/${e.vscodeExtUniqueId}-${(lib.findSingle (ext: "${ext.publisher}.${ext.name}" == e.vscodeExtUniqueId) "" "m" mutableExtensions ).version}''; + } + ); + + #removed not defined extensions + rmExtensions = lib.optionalString (nixExtensions++mutableExtensions != []) '' + find ${vscodeExtsFolderName} -mindepth 1 -maxdepth 1 ${ + lib.concatMapStringsSep " " (e : "! -iname ${e.publisher}.${e.name} ") nixExtensions + + + lib.concatMapStringsSep " " (e : "! -iname ${e.publisher}.${e.name}-${e.version} ") mutableExtensions + } -exec rm -rf {} \; + ''; + #copy mutable extension out of the nix store + cpExtensions = '' + ${lib.concatMapStringsSep "\n" (e : "ln -sfn ${e}/share/vscode/extensions/* ${vscodeExtsFolderName}/") nixExtsDrvs} + ${lib.concatMapStringsSep "\n" (ePath : '' + if [ ! -d ${ePath.target} ]; then + cp -a ${ePath.origin} ${ePath.target} + chmod -R u+rwx ${ePath.target} + fi + '') mutableExtsPaths} + ''; +in + writeShellScriptBin "code" '' + if ! [[ "$@" =~ "--list-extension" ]]; then + mkdir -p "${vscodeExtsFolderName}" + ${rmExtensions} + ${cpExtensions} + fi + ${vscode}/bin/code --extensions-dir "${vscodeExtsFolderName}" ${ + lib.optionalString (user-data-dir != "") "--user-data-dir ${user-data-dir}" + } "$@" + '' diff --git a/nixpkgs/pkgs/misc/vscode-extensions/wakatime/default.nix b/nixpkgs/pkgs/misc/vscode-extensions/wakatime/default.nix new file mode 100644 index 000000000000..7290c04342ea --- /dev/null +++ b/nixpkgs/pkgs/misc/vscode-extensions/wakatime/default.nix @@ -0,0 +1,30 @@ +{ lib +, wakatime, vscode-utils }: + +let + inherit (vscode-utils) buildVscodeMarketplaceExtension; +in + buildVscodeMarketplaceExtension { + mktplcRef = { + name = "vscode-wakatime"; + publisher = "WakaTime"; + version = "4.0.9"; + sha256 = "0sm2fr9zbk1759r52dpnz9r7xbvxladlpinlf2i0hyaa06bhp3b1"; + }; + + postPatch = '' + mkdir wakatime-cli + ln -s ${wakatime}/bin/wakatime ./wakatime-cli/wakatime-cli + ''; + + meta = with lib; { + description = '' + Visual Studio Code plugin for automatic time tracking and metrics generated + from your programming activity + ''; + license = licenses.bsd3; + maintainers = with maintainers; [ + eadwu + ]; + }; + } |