Problem: as a user of nixpkgs, I want to be able to install newly released versions of applications easily.
For example, if I read that vscode 1.25.2 is released, I’d like to be able to try it out using a (made up) invocations like
$ nix-env -iA nixos.vscode --override --version "1.25.2" --sha256 "..."
In theory, override and overrideAttrs should allow me to do something similar, but I want to argue that in practice they are not quite there yet, and I wonder if we can improve things?
Let’s look at the vscode derivation, for example:
There, the version and sha256 bindings are both local variables, so you can’t use .override to change them.
You can use .overrideAttrs to change every aspect of derivation, as usual, but that severely leaks implementation details of the derivation. With overrideAttrs, I’ll need to override src with fetchUrl, so I’ll need to replicate the logic for constructing the url. I’ll also need to update the name attr, or it’ll use the wrong version.
I think that the situation might be improved with the following guideline:
For binary application packages, make
versionandsha256overridable with.overrideby making them default parameters of derivations, instead of local variables or hard-coded values.
Does this sound at all reasonable? Note: I’m more of a casual Nix user rather then developer, I might be misunderstanding something or making false assumptions.