Is it possible to query the binary cache?

I am trying to set up a Nix environment for development across both Linux and macOS machines. Currently creating a pin for nixpkgs, and I’m trying to confirm that the nixpkgs revision I pin to is one that has existing cached builds for both platforms so as to avoid long build times. Is there a way I can do this?

1 Like

Yes, but you’ll need to know which paths you’re looking for. If you have that, you can use nix path-info (caveat: the nix command is currently not stable and usage may change in future versions of nix):

nix path-info \
  --store https://cache.nixos.org/ \
  -f /path/to/nixpkgs \
  --argstr system x86_64-linux \
  hello python3 nodejs

(rinse and repeat with x64_64-darwin for macOS)

If it returns a nonzero exit code, the cache couldn’t be reached or didn’t contain all of the desired paths.

1 Like