| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
* There are two main functions: get_download_url (system‑specific binary) and get_src_download_url (source tarball). * Avoid using nix to retrieve data whenever possible, but provide a fallback to nix if the non‑Nix method does not yield results. Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
* version is now required * better error handling * etc... Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
…-artifact@v7 and actions/download-artifact@v8 with a full-length commit SHA. Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
* Correct typo * Add tests Signed-off-by: Chin Yeung Li <tli@nexb.com>
|
I am cancelling this PR as I've already implemented the workaround code to work on nix in other repo. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Reference: #201
The code tries to get package metadata from https://search.devbox.sh/v2/. If the package cannot be found there, it will try to use the nix command to retrieve the metadata (if nix is installed on the host system).
It then uses https://cache.nixos.org/ to retrieve the download url such as: https://cache.nixos.org/0kz6msxd62b2hx2pacs1vvl6al5ma3ri.narinfo
Note that there are certain requirements: a system qualifier and version are required.
In addition to getting the download URL of the binary, I've also implemented a function to get the upstream source download URL.
Some samples run:
>>> from fetchcode import fetch >>> from fetchcode import nix >>> f = fetch("pkg:nix/nixpkgs/vixl@8.0.0?system=aarch64-linux") >>> f.url 'https://cache.nixos.org/nar/1p9ml56vj79vng8c91vjxfdjmydia19fr7lir40ns4hqcy7lac37.nar.zst' >>> print(nix.Nix.get_upstream_src_download_url("pkg:nix/nixpkgs/vixl@8.0.0?system=aarch64-linux")) https://github.com/Linaro/vixl/archive/8.0.0.tar.gz >>> g = fetch("pkg:nix/nixpkgs/imlib2@1.12.4?system=x86_64-linux") >>> g.url 'https://cache.nixos.org/nar/0jxici9pc89vqa656rwjzlvk1rwrl6zg9dn8gpvh3p8g62n48328.nar.xz' >>> print(nix.Nix.get_upstream_src_download_url("pkg:nix/nixpkgs/imlib2@1.12.4?system=x86_64-linux")) https://downloads.sourceforge.net/enlightenment/imlib2-1.12.4.tar.xz >>> print(nix.Nix.get_upstream_src_download_url("pkg:nix/hyprland/hyprland@0.53.3?flakeref=github:hyprwm/Hyprland")) https://github.com/hyprwm/Hyprland/archive/dd220efe7b1e292415bd0ea7161f63df9c95bfd3.tar.gz(Note that the flakeref qualifier only works for get_upstream_src_download_url, as "cache.nixos.org" only stores official packages, whereas flakeref usually points to third-party locations.)
For reference, the official Nix packages can be found at https://search.nixos.org/packages