How to query for version updates of packages in a buildEnv?

The nixpkgs manual section 2.6 describes how to build an environment.

When looking to upgrade the current system I’ll typically do this:

nix-channel --update
nix-env -qc  # see what version updates are available
nix-env --upgrade. #perform upgrades

But for a buildEnv like myPackages such as that suggested by the manual doesn’t show the packages contained within it nor the upgrade versions available for that env.

Is there a way to do this?

As your package hasn’t updated, but only it’s inputs, nix-env won’t update it.

You need to either force rebuilding with updated buildInputs (nix-env --upgrade --all IIRC) or use something like home-manager.

Though you can of course also manage your packages declaratively in your configuration.nix systemwide.

Actually, I’m not too concerned that nix-env --upgrade didn’t touch the buildEnv. What I’m interested to know (perhaps my question wasn’t clear) is this:

  1. What versions of packages are included in the buildEnv? (equivalent to nix-env -q)
  2. What upgrades are available to the packages included in a buildEnv? (equivalent to nix-env -qc)