Avoid full rebuild

Sorry for a newb question. I just starting using nix to build static podman from source. I ran this:

curl -L https://nixos.org/nix/install | sh

git clone https://github.com/containers/podman.git && cd podman

nix build -f nix/

I got a successful build of the master binary.

Then I checkout a released version:

git checkout v3.1.0

And finally ran

nix build -f nix/

It looked to me like nix started building all of the packages from scratch and I had 28 i.e. 27 + podman.

I expected that all other dependencies should be cached because a new build started right after the 1st one completed.

I tried looking into documentation but couldn’t find any clues

the 2nd build in the process looks like 1/19/28, shouldn’t rebuild be like 2/x/x ?

Any clues are appreciated,

The source provided to the derivation is different so it requires a full rebuild in order to be reproducible.

master and 3.1.0 use different pinned versions of nixpkgs:

So, given that many dependencies have probably changed, it’s expected that different output paths are fetched from the cache and packages are rebuilt.