vscode-extensions.vadimcn.vscode-lldb: Fix update.sh

- Fix nix-shell invocation (`-p packages` and `path` are mutually
  exclusive)
- Patch hashes in the correct files
- Use nurl instead of nix-prefetch (the latter currently fails due to
  <https://github.com/msteen/nix-prefetch/issues/54>)
- Update GitHub repo name

Fixes #204311
This commit is contained in:
Francis Gagné
2025-05-07 23:47:18 +05:30
committed by Masum Reza
parent c612142e8d
commit a7f22e8826
2 changed files with 25 additions and 6 deletions
@@ -0,0 +1,17 @@
{
pkgs ? import ../../../../../.. { },
}:
# Ideally, pkgs points to default.nix file of Nixpkgs official tree
with pkgs;
mkShell {
inputsFrom = [
(import ../../update-shell.nix { inherit pkgs; })
];
packages = [
nix-prefetch-github
nurl
prefetch-npm-deps
];
}
@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell ../../update-shell.nix -i bash -p nix-prefetch-github prefetch-npm-deps
#! nix-shell update-shell.nix -i bash
set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
@@ -12,8 +12,10 @@ of https://github.com/vadimcn/llvm-project and update lldb with correct version
# Ideally, nixpkgs points to default.nix file of Nixpkgs official tree
nixpkgs=../../../../../..
nixFile=./default.nix
adapterNixFile=./adapter.nix
nodeDepsNixFile=./node_deps.nix
owner=vadimcn
repo=vscode-lldb
repo=codelldb
version="$1"
if [[ $# -ne 1 ]]; then
# no version specified, find the newest one
@@ -34,14 +36,14 @@ echo "$old_version -> $version"
# update hashes
sed -E 's/\bversion = ".*?"/version = "'$version'"/' --in-place "$nixFile"
srcHash=$(nix-prefetch-github vadimcn vscode-lldb --rev "v$version" | jq --raw-output .hash)
srcHash=$(nix-prefetch-github vadimcn codelldb --rev "v$version" | jq --raw-output .hash)
sed -E 's#\bhash = ".*?"#hash = "'$srcHash'"#' --in-place "$nixFile"
cargoHash=$(nix-prefetch "{ sha256 }: (import $nixpkgs {}).vscode-extensions.vadimcn.vscode-lldb.adapter.cargoDeps.overrideAttrs (_: { outputHash = sha256; })")
sed -E 's#\bcargoHash = ".*?"#cargoHash = "'$cargoHash'"#' --in-place "$nixFile"
cargoHash=$(nurl --expr "(import $nixpkgs {}).vscode-extensions.vadimcn.vscode-lldb.adapter.cargoDeps.vendorStaging")
sed -E 's#\bcargoHash = ".*?"#cargoHash = "'$cargoHash'"#' --in-place "$adapterNixFile"
pushd $TMPDIR
curl -LO https://raw.githubusercontent.com/$owner/$repo/v${version}/package-lock.json
npmDepsHash=$(prefetch-npm-deps ./package-lock.json)
popd
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'$npmDepsHash'"#' --in-place "$nixFile"
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'$npmDepsHash'"#' --in-place "$nodeDepsNixFile"