A command-line tool for searching NixOS packages using the search.nixos.org API.
- Search for packages by name, description, or other attributes
- Filter results by architecture/platform
- Paginate through search results
- Display results in a formatted table or plain text
- Supports different NixOS channels
Clone the repository and make the script executable:
git clone https://github.com/yourusername/nix-search.git
cd nix-search
chmod +x nix-pkg-query.pyBasic usage:
./nix-pkg-query.py QUERY- -a, --arch : Target architecture (e.g., x86_64-linux, aarch64-darwin)
- -n, --num-results : Number of results to display (max 50)
- -p, --page : Page number for results
- -c, --channel : NixOS channel to search (default: 24.11)
- --plain : Output only package names, one per line
Search for Python packages:
./nix-pkg-query.py pythonSearch for VSCode on Linux:
./nix-pkg-query.py -a x86_64-linux vscodeShow 20 results on page 2 for GCC:
./nix-pkg-query.py -n 20 -p 2 gccOutput just package names for Firefox:
./nix-pkg-query.py --plain firefoxThe plain output mode is useful for piping results to other commands:
# Install the first matching package
nix-env -iA nixpkgs.$(./nix-pkg-query.py --plain firefox)
# List all matching packages and select with fzf
./nix-pkg-query.py -n 50 --plain python | fzf | xargs -I{} nix-env -iA nixpkgs.{}This tool uses the same Elasticsearch API that powers the search.nixos.org website. It authenticates with the API, sends your search query, and formats the results for easy viewing in the terminal.