uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
160
pkgs/applications/editors/vscode/extensions/_maintainers/update-bin-srcs-lib.sh
Executable file
160
pkgs/applications/editors/vscode/extensions/_maintainers/update-bin-srcs-lib.sh
Executable file
|
|
@ -0,0 +1,160 @@
|
|||
#!/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'"
|
||||
|
||||
# Assume packages without an architectures are for x86_64 and remap arm64 to aarch64.
|
||||
declare jqQuery
|
||||
jqQuery=$(cat <<'EOF'
|
||||
.runtimeDependencies
|
||||
| map(select(.platforms[] | in({"linux": null, "darwin": null})))
|
||||
| map(select(.architectures == null).architectures |= ["x86_64"])
|
||||
| map(del(.architectures[] | select(. | in({"x86_64": null, "arm64": null}) | not)))
|
||||
| map((.architectures[] | select(. == "arm64")) |= "aarch64")
|
||||
| map(select(.architectures != []))
|
||||
| .[] | {
|
||||
(.id + "__" + (.architectures[0]) + "-" + (.platforms[0])):
|
||||
{installPath, binaries, urls: [.url, .fallbackUrl] | map(select(. != null))}
|
||||
}
|
||||
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'
|
||||
}
|
||||
111
pkgs/applications/editors/vscode/extensions/cpptools/default.nix
Normal file
111
pkgs/applications/editors/vscode/extensions/cpptools/default.nix
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
{ lib, vscode-utils
|
||||
, fetchurl, mono, writeScript, runtimeShell
|
||||
, jq, clang-tools
|
||||
, gdbUseFixed ? true, gdb # The gdb default setting will be fixed to specified. Use version from `PATH` otherwise.
|
||||
}:
|
||||
|
||||
/*
|
||||
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.9.1";
|
||||
};
|
||||
|
||||
vsix = fetchurl {
|
||||
name = "${mktplcRef.publisher}-${mktplcRef.name}.gz";
|
||||
url = "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${mktplcRef.publisher}/vsextensions/${mktplcRef.name}/${mktplcRef.version}/vspackage?targetPlatform=linux-x64";
|
||||
sha256 = "sha256-BtTl9DR8hnwNpO5k99M4dtqcTQ2hTzVbjR8VZh+tdDI=";
|
||||
};
|
||||
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
|
||||
gzip -d $src --stdout &> temporary.zip
|
||||
unzip temporary.zip
|
||||
rm temporary.zip
|
||||
|
||||
cd extension/
|
||||
|
||||
runHook postUnpack
|
||||
'';
|
||||
|
||||
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/bin/OpenDebugAD7 ./debugAdapters/bin/OpenDebugAD7_orig
|
||||
cp -p "${openDebugAD7Script}" "./debugAdapters/bin/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" ];
|
||||
};
|
||||
}
|
||||
51
pkgs/applications/editors/vscode/extensions/cpptools/missing_elf_deps.sh
Executable file
51
pkgs/applications/editors/vscode/extensions/cpptools/missing_elf_deps.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -p coreutils -i bash
|
||||
|
||||
scriptDir=$(cd "`dirname "$0"`"; pwd)
|
||||
echo "scriptDir='$scriptDir'"
|
||||
|
||||
function get_pkg_out() {
|
||||
local pkg="$1"
|
||||
local suffix="${2:-}"
|
||||
local nixExp="with (import <nixpkgs> {}); ${pkg}"
|
||||
echo "$(nix-build -E "$nixExp" --no-out-link)${suffix}"
|
||||
}
|
||||
|
||||
interpreter="$(get_pkg_out "stdenv.cc.libc" "/lib/ld-linux-x86-64.so.2")"
|
||||
echo "interpreter='$interpreter'"
|
||||
|
||||
# For clangformat dep on 'libtinfo.so.5'.
|
||||
ncursesLibDir="$(get_pkg_out "ncurses5.out" "/lib")"
|
||||
echo "ncursesLibDir='$ncursesLibDir'"
|
||||
|
||||
# For clanformat dep on 'libstdc++.so.6'.
|
||||
stdcppLibDir="$(get_pkg_out "stdenv.cc.cc.lib" "/lib")"
|
||||
echo "stdcppLibDir='$stdcppLibDir'"
|
||||
|
||||
# For clangformat dep on 'libz.so.1'.
|
||||
zlibLibDir="$(get_pkg_out "zlib.out" "/lib")"
|
||||
echo "zlibLibDir='$zlibLibDir'"
|
||||
|
||||
function patchelf_mono() {
|
||||
local exe="$1"
|
||||
patchelf --set-interpreter "$interpreter" "$exe"
|
||||
}
|
||||
|
||||
function patchelf_clangformat() {
|
||||
local exe="$1"
|
||||
patchelf --set-interpreter "$interpreter" "$exe"
|
||||
local rpath="$ncursesLibDir:$stdcppLibDir:$zlibLibDir"
|
||||
patchelf --set-rpath "$rpath" "$exe"
|
||||
}
|
||||
|
||||
function print_nix_version_clangtools() {
|
||||
nixClangToolsBin="$(get_pkg_out "clang-tools" "/bin")"
|
||||
echo "nixClangToolsBin='$nixClangToolsBin'"
|
||||
$nixClangToolsBin/clang-format --version
|
||||
}
|
||||
|
||||
function print_nix_version_mono() {
|
||||
nixMonoBin="$(get_pkg_out "mono" "/bin")"
|
||||
echo "nixMonoBin='$nixMonoBin'"
|
||||
$nixMonoBin/mono --version
|
||||
}
|
||||
|
|
@ -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"
|
||||
]
|
||||
168
pkgs/applications/editors/vscode/extensions/cpptools/update_helper.sh
Executable file
168
pkgs/applications/editors/vscode/extensions/cpptools/update_helper.sh
Executable file
|
|
@ -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
|
||||
|
||||
2507
pkgs/applications/editors/vscode/extensions/default.nix
Normal file
2507
pkgs/applications/editors/vscode/extensions/default.nix
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,89 @@
|
|||
{ lib, vscode-utils }:
|
||||
|
||||
with vscode-utils;
|
||||
|
||||
let
|
||||
|
||||
buildVscodeLanguagePack = { language, sha256 }:
|
||||
buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "vscode-language-pack-${language}";
|
||||
publisher = "MS-CEINTL";
|
||||
version = "1.64.3";
|
||||
inherit sha256;
|
||||
};
|
||||
meta = {
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
# See list of core language packs at https://github.com/Microsoft/vscode-loc
|
||||
{
|
||||
# French
|
||||
vscode-language-pack-fr = buildVscodeLanguagePack {
|
||||
language = "fr";
|
||||
sha256 = "sha256-6ynT1sbMgKO8iZReQ6KxFpR1VL3Nuo58MvXCtp+67vA=";
|
||||
};
|
||||
# Italian
|
||||
vscode-language-pack-it = buildVscodeLanguagePack {
|
||||
language = "it";
|
||||
sha256 = "sha256-5aNFpzNMZAZJH3n0rJevke9P6AW0au5i8+r4PXsb9Rg=";
|
||||
};
|
||||
# German
|
||||
vscode-language-pack-de = buildVscodeLanguagePack {
|
||||
language = "de";
|
||||
sha256 = "sha256-oEaWtsgktHKw52lnZTESkpzC/TTY8LO4yX11IgtMG5U=";
|
||||
};
|
||||
# Spanish
|
||||
vscode-language-pack-es = buildVscodeLanguagePack {
|
||||
language = "es";
|
||||
sha256 = "sha256-utLWbved3WCCk3XzqedbYzmyaKfbMrAmR0btT09GlxA=";
|
||||
};
|
||||
# Russian
|
||||
vscode-language-pack-ru = buildVscodeLanguagePack {
|
||||
language = "ru";
|
||||
sha256 = "sha256-0Wr2ICOiaaj4jZ555bxUJcmXO/yWDyn0UmdvxUF3WSQ=";
|
||||
};
|
||||
# Chinese (Simplified)
|
||||
vscode-language-pack-zh-hans = buildVscodeLanguagePack {
|
||||
language = "zh-hans";
|
||||
sha256 = "sha256-irTSQcVXf/V3MuZwfx4tFcvBk+xhbFZTnb7IG28s/p4=";
|
||||
};
|
||||
# Chinese (Traditional)
|
||||
vscode-language-pack-zh-hant = buildVscodeLanguagePack {
|
||||
language = "zh-hant";
|
||||
sha256 = "sha256-3IA/VTTTEqS6jrDYv50GnLXOTSC1XAMvqOVfOuvIdIs=";
|
||||
};
|
||||
# Japanese
|
||||
vscode-language-pack-ja = buildVscodeLanguagePack {
|
||||
language = "ja";
|
||||
sha256 = "sha256-rxod70ddrppEYYzukksVY1dTXR8osLFAsIPr1fSFZDg=";
|
||||
};
|
||||
# Korean
|
||||
vscode-language-pack-ko = buildVscodeLanguagePack {
|
||||
language = "ko";
|
||||
sha256 = "sha256-QYFaxJz1PqKKIiLosLQ8Tu3JNXzpxLFqgIHjjRLwjA4=";
|
||||
};
|
||||
# Czech
|
||||
vscode-language-pack-cs = buildVscodeLanguagePack {
|
||||
language = "cs";
|
||||
sha256 = "sha256-eMk+syy2h+Xb3k6QB8PqYaF4I1ydaY6eRsvOXmelh9Q=";
|
||||
};
|
||||
# Portuguese (Brazil)
|
||||
vscode-language-pack-pt-br = buildVscodeLanguagePack {
|
||||
language = "pt-BR";
|
||||
sha256 = "sha256-7Trz38KBl4sD7608MvTs02pUsdD05oHEj3Sp1LvtI7I=";
|
||||
};
|
||||
# Turkish
|
||||
vscode-language-pack-tr = buildVscodeLanguagePack {
|
||||
language = "tr";
|
||||
sha256 = "sha256-T4CTpbve3vrNdW4VDfHDg8U8cQEtuxPV5LvNdtKrqzA";
|
||||
};
|
||||
# Pseudo Language
|
||||
vscode-language-pack-qps-ploc = buildVscodeLanguagePack {
|
||||
language = "qps-ploc";
|
||||
sha256 = "sha256-rPvCr3uQPfM8vwKoV7Un5aiMZClhf6TvG1PEe3xYNI0=";
|
||||
};
|
||||
}
|
||||
|
|
@ -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";
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
{ 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 = lib.importJSON ./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;
|
||||
system = builtins.elemAt kSplit 2;
|
||||
in
|
||||
{
|
||||
inherit name system;
|
||||
installPath = v.installPath;
|
||||
binaries = v.binaries;
|
||||
bin-src = fetchurl {
|
||||
urls = v.urls;
|
||||
inherit (v) sha256;
|
||||
};
|
||||
}
|
||||
)
|
||||
rtDepsSrcsFromJson;
|
||||
|
||||
rtDepBinSrcByName = bSrcName:
|
||||
rtDepsBinSrcs."${bSrcName}__${stdenv.targetPlatform.system}";
|
||||
|
||||
omnisharp = rtDepBinSrcByName "OmniSharp";
|
||||
vsdbgs = [
|
||||
(rtDepBinSrcByName "Debugger")
|
||||
] ++ lib.optionals (stdenv.isDarwin) [
|
||||
# Include the aarch64-darwin debugger binaries on x86_64-darwin. Even though OmniSharp will be
|
||||
# running under Rosetta 2, debugging will fail to start if both sets of binaries are not present.
|
||||
(rtDepsBinSrcs."Debugger__aarch64-darwin")
|
||||
];
|
||||
razor = rtDepBinSrcByName "Razor";
|
||||
in
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "csharp";
|
||||
publisher = "ms-dotnettools";
|
||||
version = "1.23.16";
|
||||
sha256 = "sha256-fM4vcSMi2tEjIox9Twh2sRiFhXgAeRwAM9to3vtcSqI=";
|
||||
};
|
||||
|
||||
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 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"
|
||||
|
||||
'' + builtins.concatStringsSep "\n" (map (vsdbg: ''
|
||||
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"
|
||||
|
||||
'') vsdbgs) + ''
|
||||
declare razor_dir="$PWD/${razor.installPath}"
|
||||
unzip_to "${razor.bin-src}" "$razor_dir"
|
||||
chmod a+x "$razor_dir/rzls"
|
||||
touch "$razor_dir/install.Lock"
|
||||
|
||||
'' + lib.optionalString stdenv.isLinux ''
|
||||
patchelf_common "$vsdbg_dir/vsdbg"
|
||||
patchelf_common "$vsdbg_dir/vsdbg-ui"
|
||||
patchelf_common "$razor_dir/rzls"
|
||||
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace $omnisharp_dir/etc/config \
|
||||
--replace "libmono-native-compat.dylib" "libmono-native.dylib"
|
||||
'';
|
||||
|
||||
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" "x86_64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
"OmniSharp__x86_64-darwin": {
|
||||
"installPath": ".omnisharp/1.37.16",
|
||||
"binaries": [
|
||||
"./mono.osx",
|
||||
"./run"
|
||||
],
|
||||
"urls": [
|
||||
"https://download.visualstudio.microsoft.com/download/pr/03c32aa6-7c7a-4936-82a0-fd8f816d112f/0ea1ea1eae48552a1992ed6df782353a/omnisharp-osx-1.37.16.zip",
|
||||
"https://roslynomnisharp.blob.core.windows.net/releases/1.37.16/omnisharp-osx-1.37.16.zip"
|
||||
],
|
||||
"sha256": "0hhgfx7zs1rljhn3n9c7lci7j15yp2448z3f1d3c47a95l1hmlip"
|
||||
},
|
||||
"OmniSharp__x86_64-linux": {
|
||||
"installPath": ".omnisharp/1.37.16",
|
||||
"binaries": [
|
||||
"./mono.linux-x86_64",
|
||||
"./run"
|
||||
],
|
||||
"urls": [
|
||||
"https://download.visualstudio.microsoft.com/download/pr/03c32aa6-7c7a-4936-82a0-fd8f816d112f/9ae3ed99fc0c41c7139751dde6f2bc78/omnisharp-linux-x64-1.37.16.zip",
|
||||
"https://roslynomnisharp.blob.core.windows.net/releases/1.37.16/omnisharp-linux-x64-1.37.16.zip"
|
||||
],
|
||||
"sha256": "0a2basc6dw42fnjv9zz93ff0bsw2i3446gvcjx5mn5d8dasi483i"
|
||||
},
|
||||
"Debugger__x86_64-darwin": {
|
||||
"installPath": ".debugger/x86_64",
|
||||
"binaries": [
|
||||
"./vsdbg-ui",
|
||||
"./vsdbg"
|
||||
],
|
||||
"urls": [
|
||||
"https://download.visualstudio.microsoft.com/download/pr/49f44239-bd47-4fb5-91be-4c91d7638fff/c1122f7141735472d9583c1124024c55/coreclr-debug-osx-x64.zip",
|
||||
"https://vsdebugger.blob.core.windows.net/coreclr-debug-1-23-14/coreclr-debug-osx-x64.zip"
|
||||
],
|
||||
"sha256": "08z3k0h25gdsbmlxwayd94672hp2z7zmwdmd0nyr9j82izj3ci2m"
|
||||
},
|
||||
"Debugger__aarch64-darwin": {
|
||||
"installPath": ".debugger/arm64",
|
||||
"binaries": [
|
||||
"./vsdbg-ui",
|
||||
"./vsdbg"
|
||||
],
|
||||
"urls": [
|
||||
"https://download.visualstudio.microsoft.com/download/pr/49f44239-bd47-4fb5-91be-4c91d7638fff/96a88189c7904a517f3bb59b2dba8bd1/coreclr-debug-osx-arm64.zip",
|
||||
"https://vsdebugger.blob.core.windows.net/coreclr-debug-1-23-14/coreclr-debug-osx-arm64.zip"
|
||||
],
|
||||
"sha256": "113kz02ihvb4y5fj01wamqz2jsql2q7n7f55s9kzs9dsrmq5ffa0"
|
||||
},
|
||||
"Debugger__aarch64-linux": {
|
||||
"installPath": ".debugger",
|
||||
"binaries": [
|
||||
"./vsdbg-ui",
|
||||
"./vsdbg"
|
||||
],
|
||||
"urls": [
|
||||
"https://download.visualstudio.microsoft.com/download/pr/49f44239-bd47-4fb5-91be-4c91d7638fff/7a723bfbda6d196c52084226b6835b36/coreclr-debug-linux-arm64.zip",
|
||||
"https://vsdebugger.blob.core.windows.net/coreclr-debug-1-23-14/coreclr-debug-linux-arm64.zip"
|
||||
],
|
||||
"sha256": "1d4a5q3f7qfk3jq2i4f6g50i9i4z8z7g8ss083y9n5c1yj3629kw"
|
||||
},
|
||||
"Debugger__x86_64-linux": {
|
||||
"installPath": ".debugger",
|
||||
"binaries": [
|
||||
"./vsdbg-ui",
|
||||
"./vsdbg"
|
||||
],
|
||||
"urls": [
|
||||
"https://download.visualstudio.microsoft.com/download/pr/49f44239-bd47-4fb5-91be-4c91d7638fff/dd019b4c839f458596e26bfcfe6a3e7f/coreclr-debug-linux-x64.zip",
|
||||
"https://vsdebugger.blob.core.windows.net/coreclr-debug-1-23-14/coreclr-debug-linux-x64.zip"
|
||||
],
|
||||
"sha256": "0c5y0035sa07bl3m3iiqccqd92xjwpcfjrqhmi5xligk40q2i2gk"
|
||||
},
|
||||
"Razor__x86_64-linux": {
|
||||
"installPath": ".razor",
|
||||
"binaries": [
|
||||
"./rzls"
|
||||
],
|
||||
"urls": [
|
||||
"https://download.visualstudio.microsoft.com/download/pr/b8678010-2cd7-4201-a5e7-ba57920607d5/b846e9c7d7afdba54a72fae1dcb6c42c/razorlanguageserver-linux-x64-6.0.0-preview.5.21358.6.zip"
|
||||
],
|
||||
"sha256": "0gb36nlb7fgcv03a0awna1qyrsky6ys5gkpsmvxc5j35f1yq337b"
|
||||
},
|
||||
"Razor__x86_64-darwin": {
|
||||
"installPath": ".razor",
|
||||
"binaries": [
|
||||
"./rzls"
|
||||
],
|
||||
"urls": [
|
||||
"https://download.visualstudio.microsoft.com/download/pr/b8678010-2cd7-4201-a5e7-ba57920607d5/ad846449769eb2ae810d0236823a6aaa/razorlanguageserver-osx-x64-6.0.0-preview.5.21358.6.zip"
|
||||
],
|
||||
"sha256": "0iqinpwwlqwajdq4i1qbb9hfpfmgy17av95bpw02ad2f9fnyh572"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/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/../_maintainers/update-bin-srcs-lib.sh"
|
||||
|
||||
declare extPublisher="ms-dotnettools"
|
||||
declare extName="csharp"
|
||||
declare defaultExtVersion="1.23.16"
|
||||
declare extVersion="${1:-$defaultExtVersion}"
|
||||
|
||||
formatExtRuntimeDeps \
|
||||
"$extPublisher" "$extName" "$extVersion" \
|
||||
| computeAndAttachExtRtDepsChecksums \
|
||||
| jqStreamToJson \
|
||||
| tee "$scriptDir/rt-deps-bin-srcs.json" \
|
||||
| jq '.'
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
{ lib, vscode-utils, jq, moreutils }:
|
||||
|
||||
let
|
||||
inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
||||
|
||||
in buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "jupyter";
|
||||
publisher = "ms-toolsai";
|
||||
version = "2021.9.1101343141";
|
||||
sha256 = "1c5dgkk5yn6a8k3blbqakqdy8ppwgfbm0ciki7ix696bvlksbpdg";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
jq
|
||||
moreutils
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Patch 'packages.json' so that the expected '__metadata' field exists.
|
||||
# This works around observed extension load failure on vscode's attempt
|
||||
# to rewrite 'packages.json' with this new information.
|
||||
print_jq_query() {
|
||||
cat <<"EOF"
|
||||
.__metadata = {
|
||||
"id": "6c2f1801-1e7f-45b2-9b5c-7782f1e076e8",
|
||||
"publisherId": "ac8eb7c9-3e59-4b39-8040-f0484d8170ce",
|
||||
"publisherDisplayName": "Microsoft",
|
||||
"installedTimestamp": 0
|
||||
}
|
||||
EOF
|
||||
}
|
||||
jq "$(print_jq_query)" ./package.json | sponge ./package.json
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Jupyter extension for vscode";
|
||||
homepage = "https://github.com/microsoft/vscode-jupyter";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ jraygauthier ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
# 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.5043";
|
||||
sha256 = "OdFOFvidUV/trySHvF8iELPNVP2kq8+vZQ4q4Nf7SiQ=";
|
||||
};
|
||||
}).overrideAttrs({ nativeBuildInputs ? [], buildInputs ? [], ... }: {
|
||||
nativeBuildInputs = nativeBuildInputs ++ [
|
||||
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" ];
|
||||
};
|
||||
})
|
||||
|
|
@ -0,0 +1 @@
|
|||
void syslog(int priority, const char *format, ...) { }
|
||||
128
pkgs/applications/editors/vscode/extensions/python/default.nix
Normal file
128
pkgs/applications/editors/vscode/extensions/python/default.nix
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
{ lib, stdenv, fetchurl, vscode-utils, extractNuGet
|
||||
, icu, curl, openssl, liburcu, 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
|
||||
liburcu-0-12 = liburcu.overrideAttrs (oldAttrs: rec {
|
||||
version = "0.12.2";
|
||||
src = fetchurl {
|
||||
url = "https://lttng.org/files/urcu/userspace-rcu-${version}.tar.bz2";
|
||||
sha256 = "0yx69kbx9zd6ayjzvwvglilhdnirq4f1x1sdv33jy8bc9wgc3vsf";
|
||||
};
|
||||
});
|
||||
|
||||
lttng-ust-2-10 = (lttng-ust.override {
|
||||
liburcu = liburcu-0-12;
|
||||
}).overrideAttrs (oldAttrs: rec {
|
||||
version = "2.10.5";
|
||||
src = fetchurl {
|
||||
url = "https://lttng.org/files/lttng-ust/lttng-ust-${version}.tar.bz2";
|
||||
sha256 = "0ddwk0nl28bkv2xb78gz16a2bvlpfbjmzwfbgwf5p1cq46dyvy86";
|
||||
};
|
||||
});
|
||||
|
||||
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 = "2022.0.1814523869";
|
||||
};
|
||||
|
||||
vsix = fetchurl {
|
||||
name = "${mktplcRef.publisher}-${mktplcRef.name}.zip";
|
||||
url = "https://github.com/microsoft/vscode-python/releases/download/${mktplcRef.version}/ms-python-release.vsix";
|
||||
sha256 = "sha256-JDaimcOUDo9GuFA3mhbbGLwqZE9ejk8pWYc+9PrRhVk=";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
icu
|
||||
curl
|
||||
openssl
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
lttng-ust-2-10
|
||||
musl
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3.pkgs.wrapPython
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
autoPatchelfHook
|
||||
];
|
||||
|
||||
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}\""
|
||||
|
||||
# Similar cleanup to what's done in the `debugpy` python package.
|
||||
# This prevent our autopatchelf logic to bark on unsupported binaries (`attach_x86.so`
|
||||
# was problematic) but also should make our derivation less heavy.
|
||||
(
|
||||
cd pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd_attach_to_process
|
||||
declare kept_aside="${{
|
||||
"x86_64-linux" = "attach_linux_amd64.so";
|
||||
"aarch64-darwin" = "attach_x86_64.dylib";
|
||||
"x86_64-darwin" = "attach_x86_64.dylib";
|
||||
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}")}"
|
||||
mv "$kept_aside" "$kept_aside.hidden"
|
||||
rm *.so *.dylib *.dll *.exe *.pdb
|
||||
mv "$kept_aside.hidden" "$kept_aside"
|
||||
)
|
||||
'';
|
||||
|
||||
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" "aarch64-darwin" "x86_64-darwin" ];
|
||||
maintainers = with maintainers; [ jraygauthier jfchevrette ];
|
||||
};
|
||||
}
|
||||
|
|
@ -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"
|
||||
'';
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
{ 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.78.0";
|
||||
sha256 = "sha256-vd+9d86Z8429QpQVCZm8gtiJDcMpD++aiFVwvCrPg5w=";
|
||||
};
|
||||
|
||||
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; [ SuperSandro2000 tbenst ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{ lib, stdenv, vscode-utils, callPackage }:
|
||||
let
|
||||
rescript-editor-analysis = (callPackage ./rescript-editor-analysis.nix { });
|
||||
arch =
|
||||
if stdenv.isLinux then "linux"
|
||||
else if stdenv.isDarwin then "darwin"
|
||||
else throw "Unsupported platform";
|
||||
analysisDir = "server/analysis_binaries/${arch}";
|
||||
in
|
||||
vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
mktplcRef = {
|
||||
name = "rescript-vscode";
|
||||
publisher = "chenglou92";
|
||||
version = "1.3.0";
|
||||
sha256 = "sha256-Sgi7FFOpI/XOeyPOrDhwZdZ+43ilUz7oQ49yB7tiMXk=";
|
||||
};
|
||||
postPatch = ''
|
||||
rm -r ${analysisDir}
|
||||
ln -s ${rescript-editor-analysis}/bin ${analysisDir}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "The official VSCode plugin for ReScript";
|
||||
homepage = "https://github.com/rescript-lang/rescript-vscode";
|
||||
maintainers = with maintainers; [ dlip ];
|
||||
license = licenses.mit;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
{ lib, stdenv, fetchFromGitHub, bash, ocaml }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "rescript-editor-analysis";
|
||||
version = "1.1.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rescript-lang";
|
||||
repo = "rescript-vscode";
|
||||
rev = "8d0412a72307b220b7f5774e2612760a2d429059";
|
||||
sha256 = "rHQtfuIiEWlSPuZvNpEafsvlXCj2Uv1YRR1IfvKfC2s=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ ocaml ];
|
||||
|
||||
postPatch = ''
|
||||
cd analysis
|
||||
substituteInPlace Makefile --replace "/bin/bash" "${bash}/bin/bash"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -D -m0555 rescript-editor-analysis.exe $out/bin/rescript-editor-analysis.exe
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Analysis binary for the ReScript VSCode plugin";
|
||||
homepage = "https://github.com/rescript-lang/rescript-vscode";
|
||||
maintainers = with maintainers; [ dlip ];
|
||||
license = licenses.mit;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "rust-analyzer",
|
||||
"version": "0.3.1059",
|
||||
"dependencies": {
|
||||
"d3": "^7.3.0",
|
||||
"d3-graphviz": "^4.1.0",
|
||||
"vscode-languageclient": "8.0.0-next.14",
|
||||
"@types/node": "~14.17.5",
|
||||
"@types/vscode": "~1.66.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.16.0",
|
||||
"@typescript-eslint/parser": "^5.16.0",
|
||||
"@vscode/test-electron": "^2.1.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.11.0",
|
||||
"tslib": "^2.3.0",
|
||||
"typescript": "^4.6.3",
|
||||
"typescript-formatter": "^7.2.2",
|
||||
"vsce": "^2.7.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, vscode-utils
|
||||
, jq
|
||||
, rust-analyzer
|
||||
, nodePackages
|
||||
, moreutils
|
||||
, esbuild
|
||||
, pkg-config
|
||||
, libsecret
|
||||
, stdenv
|
||||
, darwin
|
||||
, setDefaultServerPath ? true
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "rust-analyzer";
|
||||
publisher = "rust-lang";
|
||||
|
||||
# Use the plugin version as in vscode marketplace, updated by update script.
|
||||
inherit (vsix) version;
|
||||
|
||||
releaseTag = "2022-05-17";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rust-lang";
|
||||
repo = "rust-analyzer";
|
||||
rev = releaseTag;
|
||||
sha256 = "sha256-vrVpgQYUuJPgK1NMb1nxlCdxjoYo40YkUbZpH2Z2mwM=";
|
||||
};
|
||||
|
||||
build-deps = nodePackages."rust-analyzer-build-deps-../../applications/editors/vscode/extensions/rust-analyzer/build-deps";
|
||||
# FIXME: Making a new derivation to link `node_modules` and run `npm run package`
|
||||
# will cause a build failure.
|
||||
vsix = build-deps.override {
|
||||
src = "${src}/editors/code";
|
||||
outputs = [ "vsix" "out" ];
|
||||
|
||||
inherit releaseTag;
|
||||
|
||||
nativeBuildInputs = [
|
||||
jq moreutils esbuild
|
||||
# Required by `keytar`, which is a dependency of `vsce`.
|
||||
pkg-config libsecret
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
darwin.apple_sdk.frameworks.AppKit
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
];
|
||||
|
||||
# Follows https://github.com/rust-lang/rust-analyzer/blob/41949748a6123fd6061eb984a47f4fe780525e63/xtask/src/dist.rs#L39-L65
|
||||
postInstall = ''
|
||||
jq '
|
||||
.version = $ENV.version |
|
||||
.releaseTag = $ENV.releaseTag |
|
||||
.enableProposedApi = false |
|
||||
walk(del(.["$generated-start"]?) | del(.["$generated-end"]?))
|
||||
' package.json | sponge package.json
|
||||
|
||||
mkdir -p $vsix
|
||||
# vsce ask for continue due to missing LICENSE.md
|
||||
# Should be removed after https://github.com/rust-lang/rust-analyzer/commit/acd5c1f19bf7246107aaae7b6fe3f676a516c6d2
|
||||
echo y | npx vsce package -o $vsix/${pname}.zip
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
vscode-utils.buildVscodeExtension {
|
||||
inherit version vsix;
|
||||
name = "${pname}-${version}";
|
||||
src = "${vsix}/${pname}.zip";
|
||||
vscodeExtUniqueId = "${publisher}.${pname}";
|
||||
|
||||
nativeBuildInputs = lib.optionals setDefaultServerPath [ jq moreutils ];
|
||||
|
||||
preInstall = lib.optionalString setDefaultServerPath ''
|
||||
jq '.contributes.configuration.properties."rust-analyzer.server.path".default = $s' \
|
||||
--arg s "${rust-analyzer}/bin/rust-analyzer" \
|
||||
package.json | sponge package.json
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "An alternative rust language server to the RLS";
|
||||
homepage = "https://github.com/rust-lang/rust-analyzer";
|
||||
license = with licenses; [ mit asl20 ];
|
||||
maintainers = with maintainers; [ ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
51
pkgs/applications/editors/vscode/extensions/rust-analyzer/update.sh
Executable file
51
pkgs/applications/editors/vscode/extensions/rust-analyzer/update.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl jq libarchive
|
||||
#shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
nixpkgs=../../../../../../
|
||||
node_packages="$nixpkgs/pkgs/development/node-packages"
|
||||
owner=rust-lang
|
||||
repo=rust-analyzer
|
||||
ver=$(
|
||||
curl -s "https://api.github.com/repos/$owner/$repo/releases" |
|
||||
jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output
|
||||
)
|
||||
node_src="$(nix-build "$nixpkgs" -A rust-analyzer.src --no-out-link)/editors/code"
|
||||
|
||||
# Check vscode compatibility
|
||||
req_vscode_ver="$(jq '.engines.vscode' "$node_src/package.json" --raw-output)"
|
||||
req_vscode_ver="${req_vscode_ver#^}"
|
||||
cur_vscode_ver="$(nix-instantiate --eval --strict "$nixpkgs" -A vscode.version | tr -d '"')"
|
||||
if [[ "$(nix-instantiate --eval --strict -E "(builtins.compareVersions \"$req_vscode_ver\" \"$cur_vscode_ver\")")" -gt 0 ]]; then
|
||||
echo "vscode $cur_vscode_ver is incompatible with the extension requiring ^$req_vscode_ver"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extension_ver=$(curl "https://github.com/$owner/$repo/releases/download/$ver/rust-analyzer-linux-x64.vsix" -L |
|
||||
bsdtar -xf - --to-stdout extension/package.json | # Use bsdtar to extract vsix(zip).
|
||||
jq --raw-output '.version')
|
||||
echo "Extension version: $extension_ver"
|
||||
|
||||
# We need devDependencies to build vsix.
|
||||
# `esbuild` is a binary package an is already in nixpkgs so we omit it here.
|
||||
jq '{ name, version: $ver, dependencies: (.dependencies + .devDependencies | del(.esbuild)) }' "$node_src/package.json" \
|
||||
--arg ver "$extension_ver" \
|
||||
>"build-deps/package.json.new"
|
||||
|
||||
old_deps="$(jq '.dependencies' build-deps/package.json)"
|
||||
new_deps="$(jq '.dependencies' build-deps/package.json.new)"
|
||||
if [[ "$old_deps" == "$new_deps" ]]; then
|
||||
echo "package.json dependencies not changed, do simple version change"
|
||||
|
||||
sed -E '/^ "rust-analyzer-build-deps/,+3 s/version = ".*"/version = "'"$extension_ver"'"/' \
|
||||
--in-place "$node_packages"/node-packages.nix
|
||||
mv build-deps/package.json{.new,}
|
||||
else
|
||||
echo "package.json dependencies changed, updating nodePackages"
|
||||
mv build-deps/package.json{.new,}
|
||||
|
||||
./"$node_packages"/generate.sh
|
||||
fi
|
||||
|
||||
echo "Remember to also update the revisionTag and hash in default.nix!"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{ lib, vscode-utils, terraform-ls }:
|
||||
vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
mktplcRef = {
|
||||
name = "terraform";
|
||||
publisher = "hashicorp";
|
||||
version = "2.19.0";
|
||||
sha256 = "sha256-k/fcEJuELz0xkwivSrP6Nxtz861BLq1wR2ZDMXVrvkY=";
|
||||
};
|
||||
|
||||
patches = [ ./fix-terraform-ls.patch ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace out/serverPath.js --replace TERRAFORM-LS-PATH ${terraform-ls}/bin/terraform-ls
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ rhoriguchi ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
diff --git a/out/serverPath.js b/out/serverPath.js
|
||||
index fafa915..2e6d376 100644
|
||||
--- a/out/serverPath.js
|
||||
+++ b/out/serverPath.js
|
||||
@@ -18,7 +18,13 @@ exports.CUSTOM_BIN_PATH_OPTION_NAME = 'languageServer.pathToBinary';
|
||||
class ServerPath {
|
||||
constructor(context) {
|
||||
this.context = context;
|
||||
- this.customBinPath = vscode.workspace.getConfiguration('terraform').get(exports.CUSTOM_BIN_PATH_OPTION_NAME);
|
||||
+
|
||||
+ const customBinPath = vscode.workspace.getConfiguration('terraform').get(exports.CUSTOM_BIN_PATH_OPTION_NAME);
|
||||
+ if (!customBinPath) {
|
||||
+ this.customBinPath = 'TERRAFORM-LS-PATH';
|
||||
+ } else {
|
||||
+ this.customBinPath = customBinPath;
|
||||
+ }
|
||||
}
|
||||
installPath() {
|
||||
return path.join(this.context.globalStorageUri.fsPath, INSTALL_FOLDER_NAME);
|
||||
|
|
@ -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 exist
|
||||
, 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}
|
||||
''
|
||||
)
|
||||
)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
with import <nixpkgs>{};
|
||||
callPackage (import ./updateSettings.nix) {} {
|
||||
settings = {
|
||||
a = "fdsdf";
|
||||
};
|
||||
}
|
||||
90
pkgs/applications/editors/vscode/extensions/update_installed_exts.sh
Executable file
90
pkgs/applications/editors/vscode/extensions/update_installed_exts.sh
Executable file
|
|
@ -0,0 +1,90 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl jq unzip
|
||||
# shellcheck shell=bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# can be added to your configuration with the following command and snippet:
|
||||
# $ ./pkgs/applications/editors/vscode/extensions/update_installed_exts.sh > extensions.nix
|
||||
#
|
||||
# packages = with pkgs;
|
||||
# (vscode-with-extensions.override {
|
||||
# vscodeExtensions = map
|
||||
# (extension: vscode-utils.buildVscodeMarketplaceExtension {
|
||||
# mktplcRef = {
|
||||
# inherit (extension) name publisher version sha256;
|
||||
# };
|
||||
# })
|
||||
# (import ./extensions.nix).extensions;
|
||||
# })
|
||||
# ]
|
||||
|
||||
# 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 --retry 3 --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 || command -v codium)
|
||||
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}'
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "vscode-lldb",
|
||||
"version": "1.6.8",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
@ -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})
|
||||
|
||||
|
||||
|
|
@ -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.10";
|
||||
|
||||
vscodeExtUniqueId = "${publisher}.${pname}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "vadimcn";
|
||||
repo = "vscode-lldb";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-4PM/818UFHRZekfbdhS/Rz0Pu6HOjJEldi4YuBWECnI=";
|
||||
};
|
||||
|
||||
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-Ch1X2vN+p7oCqSs/GIu5IzG+pcSKmQ+VwP2T8ycRhos=";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
buildAndTestSubdir = "adapter";
|
||||
|
||||
buildFeatures = [ "weak-linkage" ];
|
||||
|
||||
cargoBuildFlags = [
|
||||
"--lib"
|
||||
"--bin=codelldb"
|
||||
];
|
||||
|
||||
# Tests are linked to liblldb but it is not available here.
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
nodeDeps = nodePackages."vscode-lldb-build-deps-../../applications/editors/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; [ nigelgbanks ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
@ -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'
|
||||
'';
|
||||
})
|
||||
|
|
@ -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",
|
||||
-]
|
||||
46
pkgs/applications/editors/vscode/extensions/vscode-lldb/update.sh
Executable file
46
pkgs/applications/editors/vscode/extensions/vscode-lldb/update.sh
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell ../../update-shell.nix -i bash
|
||||
|
||||
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.
|
||||
"
|
||||
|
||||
# Ideally, nixpkgs points to default.nix file of Nixpkgs official tree
|
||||
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")
|
||||
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)"
|
||||
oldDeps="$(jq '.dependencies' build-deps/package.json)"
|
||||
newDeps="$(jq '.dependencies + .devDependencies' "$src/package.json")"
|
||||
jq '{ name, version: $version, dependencies: (.dependencies + .devDependencies) }' \
|
||||
--arg version "$version" \
|
||||
"$src/package.json" \
|
||||
> build-deps/package.json
|
||||
|
||||
if [[ "$oldDeps" == "$newDeps" ]]; then
|
||||
echo "Dependencies not changed"
|
||||
sed '/"vscode-lldb-build-deps-/,+3 s/version = ".*"/version = "'"$version"'"/' \
|
||||
--in-place "$nixpkgs/pkgs/development/node-packages/node-packages.nix"
|
||||
else
|
||||
echo "Dependencies changed"
|
||||
# Regenerate nodePackages.
|
||||
cd "$nixpkgs/pkgs/development/node-packages"
|
||||
exec ./generate.sh
|
||||
fi
|
||||
100
pkgs/applications/editors/vscode/extensions/vscode-utils.nix
Normal file
100
pkgs/applications/editors/vscode/extensions/vscode-utils.nix
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
{ 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 ? ''
|
||||
runHook preConfigure
|
||||
runHook postConfigure
|
||||
'',
|
||||
buildPhase ?''
|
||||
runHook preBuild
|
||||
runHook postBuild
|
||||
'',
|
||||
dontPatchELF ? true,
|
||||
dontStrip ? true,
|
||||
nativeBuildInputs ? [],
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation ((removeAttrs a [ "vscodeExtUniqueId" ]) // {
|
||||
|
||||
name = "vscode-extension-${name}";
|
||||
|
||||
inherit vscodeExtUniqueId;
|
||||
inherit configurePhase buildPhase dontPatchELF dontStrip;
|
||||
|
||||
installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}";
|
||||
|
||||
nativeBuildInputs = [ unzip ] ++ nativeBuildInputs;
|
||||
|
||||
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;
|
||||
}
|
||||
86
pkgs/applications/editors/vscode/extensions/vscodeEnv.nix
Normal file
86
pkgs/applications/editors/vscode/extensions/vscodeEnv.nix
Normal file
|
|
@ -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 ];
|
||||
}
|
||||
|
|
@ -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";
|
||||
};
|
||||
}
|
||||
|
|
@ -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 ']'
|
||||
''
|
||||
|
|
@ -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}"
|
||||
} "$@"
|
||||
''
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{ lib
|
||||
, vscode-utils }:
|
||||
|
||||
let
|
||||
inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
||||
in
|
||||
buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "vscode-wakatime";
|
||||
publisher = "WakaTime";
|
||||
version = "18.0.5";
|
||||
sha256 = "sha256-vWqGxMbxKqd4UgKK0sOKadMTDf6Y3TQxfWsc93MHjFs=";
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = ''
|
||||
Visual Studio Code plugin for automatic time tracking and metrics generated
|
||||
from your programming activity
|
||||
'';
|
||||
license = licenses.bsd3;
|
||||
};
|
||||
}
|
||||
195
pkgs/applications/editors/vscode/generic.nix
Normal file
195
pkgs/applications/editors/vscode/generic.nix
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
{ stdenv, lib, makeDesktopItem
|
||||
, unzip, libsecret, libXScrnSaver, libxshmfence, wrapGAppsHook, makeWrapper
|
||||
, atomEnv, at-spi2-atk, autoPatchelfHook
|
||||
, systemd, fontconfig, libdbusmenu, glib, buildFHSUserEnvBubblewrap
|
||||
, writeShellScriptBin
|
||||
|
||||
# Populate passthru.tests
|
||||
, tests
|
||||
|
||||
# needed to fix "Save as Root"
|
||||
, nodePackages, bash
|
||||
|
||||
# Attributes inherit from specific versions
|
||||
, version, src, meta, sourceRoot
|
||||
, executableName, longName, shortName, pname, updateScript
|
||||
# sourceExecutableName is the name of the binary in the source archive, over
|
||||
# which we have no control
|
||||
, sourceExecutableName ? executableName
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
unwrapped = stdenv.mkDerivation {
|
||||
|
||||
inherit pname version src sourceRoot;
|
||||
|
||||
passthru = {
|
||||
inherit executableName longName tests updateScript;
|
||||
fhs = fhs {};
|
||||
fhsWithPackages = f: fhs { additionalPkgs = f; };
|
||||
};
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = executableName;
|
||||
desktopName = longName;
|
||||
comment = "Code Editing. Redefined.";
|
||||
genericName = "Text Editor";
|
||||
exec = "${executableName} %F";
|
||||
icon = "code";
|
||||
startupNotify = true;
|
||||
startupWMClass = shortName;
|
||||
categories = [ "Utility" "TextEditor" "Development" "IDE" ];
|
||||
mimeTypes = [ "text/plain" "inode/directory" ];
|
||||
keywords = [ "vscode" ];
|
||||
actions.new-empty-window = {
|
||||
name = "New Empty Window";
|
||||
exec = "${executableName} --new-window %F";
|
||||
icon = "code";
|
||||
};
|
||||
};
|
||||
|
||||
urlHandlerDesktopItem = makeDesktopItem {
|
||||
name = executableName + "-url-handler";
|
||||
desktopName = longName + " - URL Handler";
|
||||
comment = "Code Editing. Redefined.";
|
||||
genericName = "Text Editor";
|
||||
exec = executableName + " --open-url %U";
|
||||
icon = "code";
|
||||
startupNotify = true;
|
||||
categories = [ "Utility" "TextEditor" "Development" "IDE" ];
|
||||
mimeTypes = [ "x-scheme-handler/vscode" ];
|
||||
keywords = [ "vscode" ];
|
||||
noDisplay = true;
|
||||
};
|
||||
|
||||
buildInputs = [ libsecret libXScrnSaver libxshmfence ]
|
||||
++ lib.optionals (!stdenv.isDarwin) ([ at-spi2-atk ] ++ atomEnv.packages);
|
||||
|
||||
runtimeDependencies = lib.optional stdenv.isLinux [ (lib.getLib systemd) fontconfig.lib libdbusmenu ];
|
||||
|
||||
nativeBuildInputs = [ unzip ]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
autoPatchelfHook
|
||||
nodePackages.asar
|
||||
(wrapGAppsHook.override { inherit makeWrapper; })
|
||||
];
|
||||
|
||||
dontBuild = true;
|
||||
dontConfigure = true;
|
||||
noDumpEnvVars = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
'' + (if stdenv.isDarwin then ''
|
||||
mkdir -p "$out/Applications/${longName}.app" "$out/bin"
|
||||
cp -r ./* "$out/Applications/${longName}.app"
|
||||
ln -s "$out/Applications/${longName}.app/Contents/Resources/app/bin/${sourceExecutableName}" "$out/bin/${executableName}"
|
||||
'' else ''
|
||||
mkdir -p "$out/lib/vscode" "$out/bin"
|
||||
cp -r ./* "$out/lib/vscode"
|
||||
|
||||
ln -s "$out/lib/vscode/bin/${sourceExecutableName}" "$out/bin/${executableName}"
|
||||
|
||||
mkdir -p "$out/share/applications"
|
||||
ln -s "$desktopItem/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop"
|
||||
ln -s "$urlHandlerDesktopItem/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop"
|
||||
|
||||
mkdir -p "$out/share/pixmaps"
|
||||
cp "$out/lib/vscode/resources/app/resources/linux/code.png" "$out/share/pixmaps/code.png"
|
||||
|
||||
# Override the previously determined VSCODE_PATH with the one we know to be correct
|
||||
sed -i "/ELECTRON=/iVSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}"
|
||||
grep -q "VSCODE_PATH='$out/lib/vscode'" "$out/bin/${executableName}" # check if sed succeeded
|
||||
'') + ''
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
gappsWrapperArgs+=(
|
||||
# Add gio to PATH so that moving files to the trash works when not using a desktop environment
|
||||
--prefix PATH : ${glib.bin}/bin
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
|
||||
)
|
||||
'';
|
||||
|
||||
# See https://github.com/NixOS/nixpkgs/issues/49643#issuecomment-873853897
|
||||
# linux only because of https://github.com/NixOS/nixpkgs/issues/138729
|
||||
postPatch = lib.optionalString stdenv.isLinux ''
|
||||
# this is a fix for "save as root" functionality
|
||||
packed="resources/app/node_modules.asar"
|
||||
unpacked="resources/app/node_modules"
|
||||
asar extract "$packed" "$unpacked"
|
||||
substituteInPlace $unpacked/@vscode/sudo-prompt/index.js \
|
||||
--replace "/usr/bin/pkexec" "/run/wrappers/bin/pkexec" \
|
||||
--replace "/bin/bash" "${bash}/bin/bash"
|
||||
rm -rf "$packed"
|
||||
|
||||
# without this symlink loading JsChardet, the library that is used for auto encoding detection when files.autoGuessEncoding is true,
|
||||
# fails to load with: electron/js2c/renderer_init: Error: Cannot find module 'jschardet'
|
||||
# and the window immediately closes which renders VSCode unusable
|
||||
# see https://github.com/NixOS/nixpkgs/issues/152939 for full log
|
||||
ln -rs "$unpacked" "$packed"
|
||||
|
||||
# this fixes bundled ripgrep
|
||||
chmod +x resources/app/node_modules/@vscode/ripgrep/bin/rg
|
||||
'';
|
||||
|
||||
inherit meta;
|
||||
};
|
||||
|
||||
# Vscode and variants allow for users to download and use extensions
|
||||
# which often include the usage of pre-built binaries.
|
||||
# This has been an on-going painpoint for many users, as
|
||||
# a full extension update cycle has to be done through nixpkgs
|
||||
# in order to create or update extensions.
|
||||
# See: #83288 #91179 #73810 #41189
|
||||
#
|
||||
# buildFHSUserEnv allows for users to use the existing vscode
|
||||
# extension tooling without significant pain.
|
||||
fhs = { additionalPkgs ? pkgs: [] }: buildFHSUserEnvBubblewrap {
|
||||
# also determines the name of the wrapped command
|
||||
name = executableName;
|
||||
|
||||
# additional libraries which are commonly needed for extensions
|
||||
targetPkgs = pkgs: (with pkgs; [
|
||||
# ld-linux-x86-64-linux.so.2 and others
|
||||
glibc
|
||||
|
||||
# dotnet
|
||||
curl
|
||||
icu
|
||||
libunwind
|
||||
libuuid
|
||||
openssl
|
||||
zlib
|
||||
|
||||
# mono
|
||||
krb5
|
||||
]) ++ additionalPkgs pkgs;
|
||||
|
||||
# symlink shared assets, including icons and desktop entries
|
||||
extraInstallCommands = ''
|
||||
ln -s "${unwrapped}/share" "$out/"
|
||||
'';
|
||||
|
||||
runScript = "${unwrapped}/bin/${executableName}";
|
||||
|
||||
# vscode likes to kill the parent so that the
|
||||
# gui application isn't attached to the terminal session
|
||||
dieWithParent = false;
|
||||
|
||||
passthru = {
|
||||
inherit executableName;
|
||||
inherit (unwrapped) pname version; # for home-manager module
|
||||
};
|
||||
|
||||
meta = meta // {
|
||||
description = ''
|
||||
Wrapped variant of ${pname} which launches in a FHS compatible envrionment.
|
||||
Should allow for easy usage of extensions without nix-specific modifications.
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
unwrapped
|
||||
18
pkgs/applications/editors/vscode/update-shell.nix
Normal file
18
pkgs/applications/editors/vscode/update-shell.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ pkgs ? import ../../../.. { } }:
|
||||
|
||||
# Ideally, pkgs points to default.nix file of Nixpkgs official tree
|
||||
with pkgs;
|
||||
|
||||
mkShell {
|
||||
packages = [
|
||||
bash
|
||||
curl
|
||||
gawk
|
||||
gnugrep
|
||||
gnused
|
||||
jq
|
||||
nix
|
||||
nix-prefetch
|
||||
nix-prefetch-scripts
|
||||
];
|
||||
}
|
||||
40
pkgs/applications/editors/vscode/update-vscode.sh
Executable file
40
pkgs/applications/editors/vscode/update-vscode.sh
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell update-shell.nix -i bash
|
||||
|
||||
# Update script for the vscode versions and hashes.
|
||||
# Usually doesn't need to be called by hand,
|
||||
# but is called by a bot: https://github.com/samuela/nixpkgs-upkeep/actions
|
||||
# Call it by hand if the bot fails to automatically update the versions.
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
ROOT="$(dirname "$(readlink -f "$0")")"
|
||||
if [ ! -f "$ROOT/vscode.nix" ]; then
|
||||
echo "ERROR: cannot find vscode.nix in $ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# VSCode
|
||||
|
||||
VSCODE_VER=$(curl --fail --silent https://api.github.com/repos/Microsoft/vscode/releases/latest | jq --raw-output .tag_name)
|
||||
sed -i "s/version = \".*\"/version = \"${VSCODE_VER}\"/" "$ROOT/vscode.nix"
|
||||
|
||||
VSCODE_X64_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-x64/stable"
|
||||
VSCODE_X64_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_X64_LINUX_URL})
|
||||
sed -i "s/x86_64-linux = \".\{52\}\"/x86_64-linux = \"${VSCODE_X64_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
|
||||
|
||||
VSCODE_X64_DARWIN_URL="https://update.code.visualstudio.com/${VSCODE_VER}/darwin/stable"
|
||||
VSCODE_X64_DARWIN_SHA256=$(nix-prefetch-url ${VSCODE_X64_DARWIN_URL})
|
||||
sed -i "s/x86_64-darwin = \".\{52\}\"/x86_64-darwin = \"${VSCODE_X64_DARWIN_SHA256}\"/" "$ROOT/vscode.nix"
|
||||
|
||||
VSCODE_AARCH64_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-arm64/stable"
|
||||
VSCODE_AARCH64_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_AARCH64_LINUX_URL})
|
||||
sed -i "s/aarch64-linux = \".\{52\}\"/aarch64-linux = \"${VSCODE_AARCH64_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
|
||||
|
||||
VSCODE_AARCH64_DARWIN_URL="https://update.code.visualstudio.com/${VSCODE_VER}/darwin-arm64/stable"
|
||||
VSCODE_AARCH64_DARWIN_SHA256=$(nix-prefetch-url ${VSCODE_AARCH64_DARWIN_URL})
|
||||
sed -i "s/aarch64-darwin = \".\{52\}\"/aarch64-darwin = \"${VSCODE_AARCH64_DARWIN_SHA256}\"/" "$ROOT/vscode.nix"
|
||||
|
||||
VSCODE_ARMV7L_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-armhf/stable"
|
||||
VSCODE_ARMV7L_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_ARMV7L_LINUX_URL})
|
||||
sed -i "s/armv7l-linux = \".\{52\}\"/armv7l-linux = \"${VSCODE_ARMV7L_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
|
||||
40
pkgs/applications/editors/vscode/update-vscodium.sh
Executable file
40
pkgs/applications/editors/vscode/update-vscodium.sh
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell update-shell.nix -i bash
|
||||
|
||||
# Update script for the vscode versions and hashes.
|
||||
# Usually doesn't need to be called by hand,
|
||||
# but is called by a bot: https://github.com/samuela/nixpkgs-upkeep/actions
|
||||
# Call it by hand if the bot fails to automatically update the versions.
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
ROOT="$(dirname "$(readlink -f "$0")")"
|
||||
if [ ! -f "$ROOT/vscodium.nix" ]; then
|
||||
echo "ERROR: cannot find vscodium.nix in $ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
update_vscodium () {
|
||||
VSCODIUM_VER=$1
|
||||
ARCH=$2
|
||||
ARCH_LONG=$3
|
||||
ARCHIVE_FMT=$4
|
||||
VSCODIUM_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-${ARCH}-${VSCODIUM_VER}.${ARCHIVE_FMT}"
|
||||
VSCODIUM_SHA256=$(nix-prefetch-url ${VSCODIUM_URL})
|
||||
sed -i "s/${ARCH_LONG} = \".\{52\}\"/${ARCH_LONG} = \"${VSCODIUM_SHA256}\"/" "$ROOT/vscodium.nix"
|
||||
}
|
||||
|
||||
# VSCodium
|
||||
|
||||
VSCODIUM_VER=$(curl -Ls -w %{url_effective} -o /dev/null https://github.com/VSCodium/vscodium/releases/latest | awk -F'/' '{print $NF}')
|
||||
sed -i "s/version = \".*\"/version = \"${VSCODIUM_VER}\"/" "$ROOT/vscodium.nix"
|
||||
|
||||
update_vscodium $VSCODIUM_VER linux-x64 x86_64-linux tar.gz
|
||||
|
||||
update_vscodium $VSCODIUM_VER darwin-x64 x86_64-darwin zip
|
||||
|
||||
update_vscodium $VSCODIUM_VER linux-arm64 aarch64-linux tar.gz
|
||||
|
||||
update_vscodium $VSCODIUM_VER darwin-arm64 aarch64-darwin zip
|
||||
|
||||
update_vscodium $VSCODIUM_VER linux-armhf armv7l-linux tar.gz
|
||||
63
pkgs/applications/editors/vscode/vscode.nix
Normal file
63
pkgs/applications/editors/vscode/vscode.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{ stdenv, lib, callPackage, fetchurl, isInsiders ? false }:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
|
||||
plat = {
|
||||
x86_64-linux = "linux-x64";
|
||||
x86_64-darwin = "darwin";
|
||||
aarch64-linux = "linux-arm64";
|
||||
aarch64-darwin = "darwin-arm64";
|
||||
armv7l-linux = "linux-armhf";
|
||||
}.${system};
|
||||
|
||||
archive_fmt = if stdenv.isDarwin then "zip" else "tar.gz";
|
||||
|
||||
sha256 = {
|
||||
x86_64-linux = "0yahcv64jblmz5q0ylgg1sghcnyam4nq47var3y18ndjpaqyb1fl";
|
||||
x86_64-darwin = "0zsizwrhc0na9dfics27i48q4x3kz0qq5m2vdjvrgi69y2iy5z4c";
|
||||
aarch64-linux = "01wpi9pdf1fjxfx8w5g5da31q561qw7ykjm9spb3arvnivq20dp2";
|
||||
aarch64-darwin = "0qk22jyn0vypsx8x4cmpab5wrmhqx6hdkm314k8k06mz5cg1v4r3";
|
||||
armv7l-linux = "04r0x31flahzw8y0kkbzqnvcwllifaa0ysr163bb5b8kiyc189kk";
|
||||
}.${system};
|
||||
in
|
||||
callPackage ./generic.nix rec {
|
||||
# Please backport all compatible updates to the stable release.
|
||||
# This is important for the extension ecosystem.
|
||||
version = "1.67.2";
|
||||
pname = "vscode";
|
||||
|
||||
executableName = "code" + lib.optionalString isInsiders "-insiders";
|
||||
longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders";
|
||||
shortName = "Code" + lib.optionalString isInsiders " - Insiders";
|
||||
|
||||
src = fetchurl {
|
||||
name = "VSCode_${version}_${plat}.${archive_fmt}";
|
||||
url = "https://update.code.visualstudio.com/${version}/${plat}/stable";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
sourceRoot = "";
|
||||
|
||||
updateScript = ./update-vscode.sh;
|
||||
|
||||
meta = with lib; {
|
||||
description = ''
|
||||
Open source source code editor developed by Microsoft for Windows,
|
||||
Linux and macOS
|
||||
'';
|
||||
mainProgram = "code";
|
||||
longDescription = ''
|
||||
Open source source code editor developed by Microsoft for Windows,
|
||||
Linux and macOS. It includes support for debugging, embedded Git
|
||||
control, syntax highlighting, intelligent code completion, snippets,
|
||||
and code refactoring. It is also customizable, so users can change the
|
||||
editor's theme, keyboard shortcuts, and preferences
|
||||
'';
|
||||
homepage = "https://code.visualstudio.com/";
|
||||
downloadPage = "https://code.visualstudio.com/Updates";
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [ eadwu synthetica maxeaubrey bobby285271 ];
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" "armv7l-linux" ];
|
||||
};
|
||||
}
|
||||
66
pkgs/applications/editors/vscode/vscodium.nix
Normal file
66
pkgs/applications/editors/vscode/vscodium.nix
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{ lib, stdenv, callPackage, fetchurl, nixosTests }:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
|
||||
plat = {
|
||||
x86_64-linux = "linux-x64";
|
||||
x86_64-darwin = "darwin-x64";
|
||||
aarch64-linux = "linux-arm64";
|
||||
aarch64-darwin = "darwin-arm64";
|
||||
armv7l-linux = "linux-armhf";
|
||||
}.${system};
|
||||
|
||||
archive_fmt = if stdenv.isDarwin then "zip" else "tar.gz";
|
||||
|
||||
sha256 = {
|
||||
x86_64-linux = "1ns4cpkihbrwgh8pvn1kjlnipssinjkxy28szidnz6q71zyvsjyw";
|
||||
x86_64-darwin = "05v0gxal74igc29qjy0ficlyna17bzh1lpfqvyxdpg22is894h2l";
|
||||
aarch64-linux = "1x6lhcvdly3a2n0shp2vlgk3s2pj9byxn9dc9pjg4k5ff24dql7l";
|
||||
aarch64-darwin = "03knkj0y6n45lin0v6288zbq1nz5qh81ijyw1w3zrpd7pijn9j0x";
|
||||
armv7l-linux = "0iwlr5q1qwq3jgldrhz4bbyl3xmdhd4ss690x1lqb4vxm2m7v5jw";
|
||||
}.${system};
|
||||
|
||||
sourceRoot = if stdenv.isDarwin then "" else ".";
|
||||
in
|
||||
callPackage ./generic.nix rec {
|
||||
inherit sourceRoot;
|
||||
|
||||
# Please backport all compatible updates to the stable release.
|
||||
# This is important for the extension ecosystem.
|
||||
version = "1.67.2";
|
||||
pname = "vscodium";
|
||||
|
||||
executableName = "codium";
|
||||
longName = "VSCodium";
|
||||
shortName = "vscodium";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/VSCodium/vscodium/releases/download/${version}/VSCodium-${plat}-${version}.${archive_fmt}";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
tests = nixosTests.vscodium;
|
||||
|
||||
updateScript = ./update-vscodium.sh;
|
||||
|
||||
meta = with lib; {
|
||||
description = ''
|
||||
Open source source code editor developed by Microsoft for Windows,
|
||||
Linux and macOS (VS Code without MS branding/telemetry/licensing)
|
||||
'';
|
||||
longDescription = ''
|
||||
Open source source code editor developed by Microsoft for Windows,
|
||||
Linux and macOS. It includes support for debugging, embedded Git
|
||||
control, syntax highlighting, intelligent code completion, snippets,
|
||||
and code refactoring. It is also customizable, so users can change the
|
||||
editor's theme, keyboard shortcuts, and preferences
|
||||
'';
|
||||
homepage = "https://github.com/VSCodium/vscodium";
|
||||
downloadPage = "https://github.com/VSCodium/vscodium/releases";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ synthetica turion bobby285271 ];
|
||||
mainProgram = "codium";
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" "armv7l-linux" ];
|
||||
};
|
||||
}
|
||||
86
pkgs/applications/editors/vscode/with-extensions.nix
Normal file
86
pkgs/applications/editors/vscode/with-extensions.nix
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{ lib, stdenv, runCommand, buildEnv, vscode, makeWrapper
|
||||
, vscodeExtensions ? [] }:
|
||||
|
||||
/*
|
||||
`vscodeExtensions`
|
||||
: A set of vscode extensions to be installed alongside the editor. Here's a an
|
||||
example:
|
||||
|
||||
~~~
|
||||
vscode-with-extensions.override {
|
||||
|
||||
# When the extension is already available in the default extensions set.
|
||||
vscodeExtensions = with vscode-extensions; [
|
||||
bbenoist.nix
|
||||
]
|
||||
|
||||
# Concise version from the vscode market place when not available in the default set.
|
||||
++ vscode-utils.extensionsFromVscodeMarketplace [
|
||||
{
|
||||
name = "code-runner";
|
||||
publisher = "formulahendry";
|
||||
version = "0.6.33";
|
||||
sha256 = "166ia73vrcl5c9hm4q1a73qdn56m0jc7flfsk5p5q41na9f10lb0";
|
||||
}
|
||||
];
|
||||
}
|
||||
~~~
|
||||
|
||||
This expression should fetch
|
||||
- the *nix* vscode extension from whatever source defined in the
|
||||
default nixpkgs extensions set `vscodeExtensions`.
|
||||
|
||||
- the *code-runner* vscode extension from the marketplace using the
|
||||
following url:
|
||||
|
||||
~~~
|
||||
https://bbenoist.gallery.vsassets.io/_apis/public/gallery/publisher/bbenoist/extension/nix/1.0.1/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
|
||||
~~~
|
||||
|
||||
The original `code` executable will be wrapped so that it uses the set of pre-installed / unpacked
|
||||
extensions as its `--extensions-dir`.
|
||||
*/
|
||||
|
||||
let
|
||||
inherit (vscode) executableName longName;
|
||||
wrappedPkgVersion = lib.getVersion vscode;
|
||||
wrappedPkgName = lib.removeSuffix "-${wrappedPkgVersion}" vscode.name;
|
||||
|
||||
combinedExtensionsDrv = buildEnv {
|
||||
name = "vscode-extensions";
|
||||
paths = vscodeExtensions;
|
||||
};
|
||||
|
||||
extensionsFlag = lib.optionalString (vscodeExtensions != []) ''
|
||||
--add-flags "--extensions-dir ${combinedExtensionsDrv}/share/vscode/extensions"
|
||||
'';
|
||||
in
|
||||
|
||||
# When no extensions are requested, we simply redirect to the original
|
||||
# non-wrapped vscode executable.
|
||||
runCommand "${wrappedPkgName}-with-extensions-${wrappedPkgVersion}" {
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [ vscode ];
|
||||
dontPatchELF = true;
|
||||
dontStrip = true;
|
||||
meta = vscode.meta;
|
||||
} (if stdenv.isDarwin then ''
|
||||
mkdir -p $out/bin/
|
||||
mkdir -p "$out/Applications/${longName}.app/Contents/MacOS"
|
||||
|
||||
for path in PkgInfo Frameworks Resources _CodeSignature Info.plist; do
|
||||
ln -s "${vscode}/Applications/${longName}.app/Contents/$path" "$out/Applications/${longName}.app/Contents/"
|
||||
done
|
||||
|
||||
makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${extensionsFlag}
|
||||
makeWrapper "${vscode}/Applications/${longName}.app/Contents/MacOS/Electron" "$out/Applications/${longName}.app/Contents/MacOS/Electron" ${extensionsFlag}
|
||||
'' else ''
|
||||
mkdir -p "$out/bin"
|
||||
mkdir -p "$out/share/applications"
|
||||
mkdir -p "$out/share/pixmaps"
|
||||
|
||||
ln -sT "${vscode}/share/pixmaps/code.png" "$out/share/pixmaps/code.png"
|
||||
ln -sT "${vscode}/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop"
|
||||
ln -sT "${vscode}/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop"
|
||||
makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${extensionsFlag}
|
||||
'')
|
||||
Loading…
Add table
Add a link
Reference in a new issue