Search code examples
nix

Where does nix-env query for available packages?


I know you can query for available packages with:

nix-env -qa search_term

from man

I'm curios, how is nix-env doing the search? Is it searching in my /nix/store or will perform some request on the binary cache server https://cache.nixos.org/ ?

It looks like it will work without network connection so I'm curios how does it know about the available packages?


Solution

  • You have a local copy of nixpkgs (you can use nix-channel to manage it), nix-env should read from pkgs/top-level/all-packages.nix.

    However you can override that position using nix-env -I "<nixpkgs_path> ...