Skip to content

Commit f7357cf

Browse files
authored
vscode-extensions-update: init (#389585)
2 parents 135faf1 + 4f9510e commit f7357cf

File tree

6 files changed

+349
-36
lines changed

6 files changed

+349
-36
lines changed

pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88
# Defaults to `false` as we expect it to be project specific most of the time.
99
pythonUseFixed ? false,
1010
# For updateScript
11-
writeScript,
12-
bash,
13-
curl,
14-
coreutils,
15-
gnused,
16-
jq,
17-
nix,
11+
vscode-extensions-update-script,
1812
}:
1913

2014
vscode-utils.buildVscodeMarketplaceExtension rec {
@@ -51,35 +45,7 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
5145
--replace-fail "\"default\":\"python\"" "\"default\":\"${python3.interpreter}\""
5246
'';
5347

54-
passthru.updateScript = writeScript "update" ''
55-
#! ${bash}/bin/bash
56-
57-
set -eu -o pipefail
58-
59-
export PATH=${
60-
lib.makeBinPath [
61-
curl
62-
coreutils
63-
gnused
64-
jq
65-
nix
66-
]
67-
}
68-
69-
api=$(curl -s 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \
70-
-H 'accept: application/json;api-version=3.0-preview.1' \
71-
-H 'content-type: application/json' \
72-
--data-raw '{"filters":[{"criteria":[{"filterType":7,"value":"${mktplcRef.publisher}.${mktplcRef.name}"}]}],"flags":16}')
73-
# Find the latest version compatible with stable vscode version
74-
version=$(echo $api | jq -r '.results[0].extensions[0].versions | map(select(has("properties"))) | map(select(.properties | map(select(.key == "Microsoft.VisualStudio.Code.Engine")) | .[0].value | test("\\^[0-9.]+$"))) | .[0].version')
75-
76-
if [[ $version != ${mktplcRef.version} ]]; then
77-
tmp=$(mktemp)
78-
curl -sLo $tmp $(echo ${(import ../mktplcExtRefToFetchArgs.nix mktplcRef).url} | sed "s|${mktplcRef.version}|$version|")
79-
hash=$(nix hash file --type sha256 --base32 --sri $tmp)
80-
sed -i -e "s|${mktplcRef.hash}|$hash|" -e "s|${mktplcRef.version}|$version|" pkgs/applications/editors/vscode/extensions/ms-python.python/default.nix
81-
fi
82-
'';
48+
passthru.updateScript = vscode-extensions-update-script { };
8349

8450
meta = {
8551
description = "Visual Studio Code extension with rich support for the Python language";

pkgs/applications/editors/vscode/extensions/rooveterinaryinc.roo-cline/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
lib,
33
vscode-utils,
4+
vscode-extensions-update-script,
45
}:
56

67
vscode-utils.buildVscodeMarketplaceExtension {
@@ -11,6 +12,8 @@ vscode-utils.buildVscodeMarketplaceExtension {
1112
hash = "sha256-7A8BQHUu7CYA28fHv68Zvf6zhlJwwXZaNVLb+/cBAIg=";
1213
};
1314

15+
passthru.updateScript = vscode-extensions-update-script { };
16+
1417
meta = {
1518
description = "AI-powered autonomous coding agent that lives in your editor";
1619
downloadPage = "https://marketplace.visualstudio.com/items?itemName=RooVeterinaryInc.roo-cline";
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
writeScriptBin,
3+
}:
4+
5+
writeScriptBin "vscode-extensions-update" (builtins.readFile ./vscode_extensions_update.py)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
lib,
3+
vscode-extensions-update,
4+
}:
5+
6+
{
7+
attrPath ? null,
8+
extraArgs ? [ ],
9+
}:
10+
11+
[ "${lib.getExe vscode-extensions-update}" ]
12+
++ lib.optionals (attrPath != null) [ attrPath ]
13+
++ extraArgs

0 commit comments

Comments
 (0)