Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override package version help #25912

Closed
ob7 opened this issue May 19, 2017 · 3 comments
Closed

Override package version help #25912

ob7 opened this issue May 19, 2017 · 3 comments

Comments

@ob7
Copy link

ob7 commented May 19, 2017

I'm using the standard nixos channel, but sometimes the packages within there are outdated.
I'm trying to install bitcoin 0.14.1, the version currently in stable is 0.12.0.
So I am trying to override the version like so:

(bitcoin.overrideDerivation (oldAttrs: {
      name = "bitcoin-0.14.1";
      core_version = "0.14.1";
      version = "0.14.1";
    }))

I'm using the same variable names that is within the bitcoin.nix file located at pkgs/applications/altcoins/bitcoin.nix

But it appears to make no difference ( other than it doing a bare build of bitcoin which takes a while ).... but the version it installs is still 0.12.0.

What am I doing wrong here?

@FRidh
Copy link
Member

FRidh commented May 19, 2017

@ob7 use overrideAttrs instead of overrideDerivation. The latter overrides the call to derivation whereas the former overrides the call to stdenv.mkDerivation. Even so, when you override the call you also have to pass in a src again or it will still use the old src argument.

@ob7
Copy link
Author

ob7 commented May 19, 2017

I figured I wouldn't need to pass the src in again since it uses the core_version variable to determine the source...
src = fetchurl { urls = [ "https://bitcoin.org/bin/bitcoin-core-${core_version}/bitcoin-${version}.tar.gz" "mirror://sourceforge/bitcoin/Bitcoin/bitcoin-${core_version}/bitcoin-${version}.tar.gz" ];
But like you said, when I pass the src explicitly it installs the version I'm asking for... any reason why passing the src is required like this when the original .nix expression sets it from the variables I am trying to override?

@lheckemann
Copy link
Member

lheckemann commented May 19, 2017

Because the version number is only used to determine where to obtain the files, but not the actual contents of the files. Given that the expected hash is still the one given in the fetchurl call in bitcoin.nix, it finds that the expected files have already been downloaded and will not download them again. If you garbage-collect and then try to build this overridden version it will likely fail, because the downloaded files will not match the hash given in the derivation. So you'll still want to override src and pass in the correct sha256 value.

@ob7 ob7 closed this as completed May 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants