-
-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix-prefetch-vscode-marketplace, nix-prefetch-openvsx: init at 0.1.0 #161369
base: master
Are you sure you want to change the base?
Conversation
3cef9a5
to
fba0ddd
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/in-tree-or-out-of-tree/18389/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please share the duplicated parts of the code. Maybe we can even combine the scripts?
pkgs/misc/vscode-registries/openvsx/nix-prefetch-openvsx/default.nix
Outdated
Show resolved
Hide resolved
pkgs/misc/vscode-registries/openvsx/nix-prefetch-openvsx/default.nix
Outdated
Show resolved
Hide resolved
pkgs/misc/vscode-registries/openvsx/nix-prefetch-openvsx/default.nix
Outdated
Show resolved
Hide resolved
pkgs/misc/vscode-registries/openvsx/nix-prefetch-openvsx/default.nix
Outdated
Show resolved
Hide resolved
pkgs/misc/vscode-registries/openvsx/nix-prefetch-openvsx/default.nix
Outdated
Show resolved
Hide resolved
pkgs/misc/vscode-registries/openvsx/nix-prefetch-openvsx/default.nix
Outdated
Show resolved
Hide resolved
pkgs/misc/vscode-registries/openvsx/nix-prefetch-openvsx/nix-prefetch-openvsx
Outdated
Show resolved
Hide resolved
68ec7b1
to
439c698
Compare
586c2e9
to
be53d2c
Compare
The slight logical difference between the two fetchers makes the merge a bit trickier than just "combining the shared commands".
I managed to combine the same part by creating a common library for the two scripts to source, in which each actions are separated into bash functions to simulate Nix-like overridable and lazily-evaluated "stages". Not sure if such approach is over-engineering. |
be53d2c
to
781b69d
Compare
781b69d
to
140f302
Compare
@SuperSandro2000 Would it be too over-engineered to merge the two scripts this way? If so, I'll change them back into two imperative scripts. |
60f5cee
to
e6ade89
Compare
...egistries/vscode-marketplace/nix-prefetch-vscode-marketplace/nix-prefetch-vscode-marketplace
Outdated
Show resolved
Hide resolved
If they share a lot of code then that is an option but I didn't take a deeper look at the scripts. |
32a8916
to
bb77ade
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/1507 |
@ShamrockLee |
@AmeerTaweel Sorry for bothering you for minor stuff like this. Just want to mention that the license information and other metadata of an extension can be extracted from the manifest (package.json) packed inside the VSIX file. The file can be extracted with unzip without decompressing the whole extension. This would be an alternative solution when the querying API is not available. |
@ShamrockLee No no I did not mean that at all. I was just confused, not bothered. Thanks for showing me this. It will be helpful with my VSCode extensions flake. It's been a while since I worked on it because of university. But I will have more time in the semester break. |
bb77ade
to
3ba5499
Compare
3ba5499
to
7c1f877
Compare
|
Actually, I'm a bit frustrated about the Bash behavior to drop This Bash behavior is documented here: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html It seems that we can only solve it by switching to another programming language or framework ( |
Anyway, I work around the above issue with the LBYL strategy by checking whether there's an attribute named The hash query implementation is here: It can be included in the future when eclipse/openvsx#678 is merged. |
I have finally found the relevant URL that VSCode use to download extension VSIX files from the Marketplace: The relevant
|
@ShamrockLee I'm sorry to let you down again. I was trying to get to this but I just couldn't. I suggest you add someone else to review this. |
Sure. |
7c1f877
to
54c7d01
Compare
As the sha256-querying feature is released from the OpenVSX upstrem, I added the implementation as the second commit. The rebasing of the first commit is only to reset the author name from Shmrock Lee to Yueh-Shun Li (my legal name). |
Motivation for this change
This patch introduces the prefetchers for Visual Studio Code extensions from the Marketplace as well as the Open VSX Registry.
This is originally part of #121583 and is part of the tooling to bootstrap and update the extensions from different registries. Considering that the multi-registry support still has a way to go and that these two prefetchers are also useful under the current extension framework, it would be great to have them merged first.
These packages were initially based upon https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/vscode-extensions/update_installed_exts.sh
Features:
mktemp -t
)-H
) or the meta-related outputs (-M
).Thanks to the Open VSX API, specifying
-H
means that the extension VSIX file will not be downloaded fornix-prefetch-openvsx
, which greatly shorten the time for query for people who only want to check the latest version or the metadata information. This doesn't apply fornix-prefetch-vscode-marketplace
due to VSCode Marketplace's lack of public documentation about their API and prohibition to third-party use from the EULA. Nevertheless, optionsM
does prevent the downloaded VSIX from being decompressed.Missing feature:
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes