`nix search nixpkgs` skip registry update

Just to start I’m not sure that “registry update” is precisely the correct term; but what I’m talking about is updating/downloading the newest package lists every time nix search nixpkgs is invoked.

Obviously those lists need to be updated periodically; but in practice I often avoid using nix search nixpkgs foo; and might instead open up https://search.nixos.org/packages?channel=unstable simply because it’s faster.

Is there a way to make nix search “just search” without taking the time to update registries or channels ( or whatever )?

1 Like

nix search should already “just search” - it should only update if you give it the -u flag. Is something else slowing down your search?

Weird mine updates almost every time I run it. If i search repeatedly it won’t, but it seems like if I wait an hour it’ll download and process packages.

Maybe I set something up wrong.

looks like there is a verbose flag, maybe that will tell us something? try nix search -vvvv foo, mine starts off with

evaluating file '/nix/store/6fr58pqy02hmgw1h7b9nqmv7vlp3v346-nix-2.3.15/share/nix/corepkgs/derivation.nix'
warning: using cached results; pass '-u' to update the cache

You can pin the registry to avoid redownloading. See: What is the best way to search for packages in the command line? - #2 by azazel75

1 Like

If you are using flakes on NixOS you can search the nixpkgs that you are using to build your system. This ensures that it is already downloaded because.

1 Like

Hey y’all thanks for the responses, for whatever reason I wasn’t receiving notifications from Discourse so I just saw these.

The suggestion by @ilkecan did the trick for me!