Say I’m writing a shell.nix
and want to use a package that is available in (already imported) <nixpkgs>
but of different version. For instance, say I want to use pytorch-lightning = 0.9.0
whereas <nixpkgs>
contains a derivation python3Packages.pytorch-lightning
with version="0.8.5."
. Can I reuse the expression to get 0.9.0
?
Let’s take a look at the derivation for pytorch-lightning
:
...
buildPythonPackage rec {
pname = "pytorch-lightning";
version = "0.8.5";
disabled = isPy27;
src = fetchFromGitHub {
owner = "PyTorchLightning";
repo = pname;
rev = version;
sha256 = "12zhq4pnfcwbgcx7cs99c751gp3w0ysaf5ykv2lv8f4i360w3r5a";
};
...
So, to get the desired behaviour I’d need to set a new version and I’d need src.rev
to get recomputed.
- As far as I understand this attribute set is evaluated eagerly and there’s no reliable way to re-evaluate it with new
version
- Even that I know I need to reset
version
andsrc.rev
, I can’t seem to understand how to get this derivation rebuilt from new sources:(ps."pytorch-lightning".overrideAttrs (o: o // { version="0.9.0"; name="pytorch-lightning-0.9.0"; src = o.src.overrideAttrs (o2: o2 // {rev = "0.9.0"; });}))
triggers building a new derivation but it still downloads./pytorch_lightning-0.8.5-py3-none-any.whl
Thanks