Skip to content

Instantly share code, notes, and snippets.

@Sigmanificient
Created April 28, 2024 13:22
Show Gist options
  • Save Sigmanificient/b1a0136b592f3ac7ba5d253a75a874ee to your computer and use it in GitHub Desktop.
Save Sigmanificient/b1a0136b592f3ac7ba5d253a75a874ee to your computer and use it in GitHub Desktop.
#!/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 "'" '"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment