3 ms·
why does it query search.nixos.org, rather than looking through your local nixpkgs? just because of how tricky it'd be to handle the nix language or hacking on
by sterlind 3y ago
why does it query search.nixos.org, rather than looking through your local nixpkgs? just because of how tricky it'd be to handle the nix language or hacking on the nix toolchain proper?
also I agree that it's ridiculous nix doesn't have a search command. it baffles me.
- ghuntley 3y agosearch.nixos.org also includes flakes that people PR into the index via GitHub at https://github.com/NixOS/nixos-search/issues https://github.com/NixOS/nixos-search/issues ps: $ nix search exists via experimental flags https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-search.html https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3...
- lilyball 3y agoIt does though. `nix search`.
- peter_l_downs 3y agoThis exists and searches `search.nixos.org` for a few reasons: - you may want to search without downloading and indexing nixpkgs and the hydra results yourself - you may want to search by the name of the binaries/programs that will be installed, which is impossible to do by looking through a local package store alone - you may want the search to be fast - you may want to search from the command line `nix search` is a cruel joke which doesn't allow searching by the name/program that would be installed, only package name, and requires a flake name every time. Absolutely terrible interface. My tool is a single-install binary that performs fast and accurate search to help you find the right package name to install a given binary. I don't understand how after years of using other package managers anyone could want a search tool that does anything other than this by default. For more details on why this exists, check out https://github.com/peterldowns/nix-search-cli#motivation https://github.com/peterldowns/nix-search-cli#motivation
- aidenn0 3y agoNix has several search commands, it's just none of them do quite what people want (e.g. "nix search" with flakes and "nix-query" without flakes search by name and description, "nix-locate" can search by contents but the interface is a bit obtuse) For those who want a local search for executables, and don't mind running nix-index: #!/bin/sh results="$(nix-locate -1 --regex --top-level "^/bin/${1}\$")" for item in $results; do nix search "nixpkgs#${item%.*}" done will search for a specific executable and give you (hopefully) reasonable output. If you don't have flakes enabled, you can just print the result of the command-substitution directly, but you won't get the short description.