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
Hard-coded package and option count on search.nixos.org #701
Comments
Search more than 100,000 packages! 👍 |
Here is a small script that retrieve the number of packages from the latest nixpkgs release #!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq brotli yq
while [ "$latest" != "null" ]; do
prev="${latest}"
latest=$(curl "https://nix-releases.s3.amazonaws.com/?delimiter=/&prefix=nixpkgs/&marker=${latest}" \
| xq -rMc ".ListBucketResult.CommonPrefixes[-1].Prefix")
echo "-> $latest"
done
target="${prev%/}"
echo "Selecting latest: $target"
count=$(curl https://releases.nixos.org/${target}/packages.json.br \
| brotli -d --stdout | jq ".packages | length")
echo "=> $count" For For options, it is almost the same script! --- count-pkgs.sh 2024-04-04 08:04:14.290391078 +0200
+++ count-options.sh 2024-04-04 08:10:17.967651425 +0200
@@ -3,14 +3,14 @@
while [ "$latest" != "null" ]; do
prev="${latest}"
- latest=$(curl "https://nix-releases.s3.amazonaws.com/?delimiter=/&prefix=nixpkgs/&marker=${latest}" \
+ latest=$(curl "https://nix-releases.s3.amazonaws.com/?delimiter=/&prefix=nixos/unstable/&marker=${latest}" \
| xq -rMc ".ListBucketResult.CommonPrefixes[-1].Prefix")
echo "-> $latest"
done
target="${prev%/}"
echo "Selecting latest: $target"
-count=$(curl https://releases.nixos.org/${target}/packages.json.br \
- | brotli -d --stdout | jq ".packages | length")
+count=$(curl https://releases.nixos.org/${target}/options.json.br \
+ | brotli -d --stdout | jq "length")
echo "=> $count" Thus, for |
Hej @Sigmanificient, nice work! Danke! You may want to contact the Documentation Team, in case you want to contribute to the code base of search.nixos.org. I'll highlight @fricklerhandwerk and @infinisil of the Docu Team, in case they missed this issue for now. |
I would love to contribute to the website, but unfortunately I don't know anything about elm, and I am unsure on what to exactly do. I shared the script in case they could help open the discussion, and I would be more than happy if they turned out useful |
Nah the docs team doesn't have write access to search.nixos.org, that's for the marketing team :) |
Ah, the infamous NixOS labyrinth, thanks for the insight @infinisil :) |
Small update: I found that Here is a newer version, that makes way fewer requests, and outputs both packages count and options count in a JSON format #!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq brotli
function parse_unstable_json() {
local url="https://channels.nixos.org/nixos-unstable/$1.json.br"
echo $(curl -L "$url" | brotli -d --stdout | jq "$2")
}
pkg_count=$(parse_unstable_json "packages" ".packages | length")
opt_count=$(parse_unstable_json "options" "length")
echo "{ 'packages': $pkg_count, 'options': $opt_count }" | tr "'" '"'
|
This issue should be renamed Hard-coded package and option count on search.nixos.org |
The message at the header saying search.nixos.org enables searching of "more than 80 000 packages" is hard-coded. Should be way higher by now, as repology also states.
The text was updated successfully, but these errors were encountered: