However, when I change the revision on the toml and exit&reenter the nix-shell that does not cause a rebuild of the src, I have to nix-collect-garbage.
Is there a way to get this to happen automatically, otherwise this might cause some issues on my CI system. I’d like to avoid “collecting garbage” there as most of the time the rev won’t change and I’d prefer to to rebuild src every run.
nix looks at the hash from the fetcher, if it can fetch that hash from a local/remote cache then it won’t re-fetch anything.
There are add on tools that does the job of recomputing this hash for you, saving you the effort of manually doing it every time you bump a version or revision. https://github.com/nmattia/niv
As a trick that would force a rebuild, set the name to the same value as the ref. This will ensure recompilation even with same sha256, as any entry is identified by its sha256 and its name, and most, if not all, fetchers use name = "source" as the default.
Thanks both, if I change the rev from 1 to 2 and the sha from 1 to 2 it does indeed “notice” the change and pulls the rev2.
However, if I then change it back to the previous rev1 and sha1 it does not “notice” this, and still seems to use the rev2!
EDIT: nevermind, I must have done something wrong to hit this like not exiting another shell or something…