I then made some changes to those derivations, and they will properly rebuild. But the mpv wrapper itself doesn’t rebuild. So the --script= inside the mpv wrapper script still points to the older version of the /nix/store path that no longer exists.
How do I make it so that the mpv wrapper rebuilds?
That’s really surprising, and I’m not sure it is even possible, as I think Nix checks for references when it builds a derivation. If you’d share with us how you build the mpvScripts.somescript attributes, that would help. Note also that you don’t have to define those script derivations as part of the mpvScripts attribute set, meaning a full overlay may look like this:
Yeah, I was overlaying it to mpvScripts because it feels a bit cleaner. But it turns that the issue was caused by the derivation being a fixed-output one.
Strangely, I did change the outputHash and I can see it rebuild in the command line, and I also can see the new generated /nix/store path and the contents updated accordingly. But the mpv wrapper script isn’t being rebuilt (it still wraps to an outdated /nix/store path).
I solved it by removing outputHash and turning it into a normal derivation. It now rebuilds just fine, really weird. But outputHash was unnecessary anyways and was just a copy-paste remnant.