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
overrideDerivation: fix meta handling #9312
Conversation
You should keep using derivation not stdenv.mkDerivation . |
d83c09f
to
3a73651
Compare
Using stdenv.mkDerivation is the only way to avoid duplicating its code. And with the various adapters, it is also the only extensible possibility. If you want to use derivation directly, then write your own stdenv, like so:
I have updated the commit to be more concise; I forgot that cross-compiling will use stdenv properly. |
278f4a5
to
788fd51
Compare
I ran nox-review locally and it completed successfully (after 278f4a5), so the Travis failure can be ignored. |
The other possibility would be to replace stdenv.mkDerivation, similarly to overrideCabal in https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/default.nix#L38, but either way the implementation will be tied to stdenv. |
788fd51
to
78fbe8a
Compare
@lethalman I have updated this, now it does not use stdenv directly. Instead, stdenv.mkDerivation is passed to makeOverridable, and makeOverridable exposes the whole of function applications (via override, overrideDerivation, overrideInner.overrideDerivation, overrideInner.overrideInner.overrideDerivation, etc.). For backwards compatibility lib.overrideDerivation does the last in the chain, which is mkDerivation for everything in nixpkgs. Unfortunately functors do not work under map (NixOS/nix#636), so this isn't mergeable at present, but it does work (with a few rebuilds due to the uses of overrideDerivation in-tree). |
2b23133
to
9682b5a
Compare
This modifies stdenv.mkDerivation to use makeOverridable, and modifies makeOverridable to allow chaining and access to the inner overrides, via overrideDerivation and overrideInner. For compatibility with the old overrideDerivation, lib.overrideDerivation is changed to drill down to the last override and pass in some empty arrays. Some packages use map mkDerivation; they need recent changes in Nix master to work.
ping all |
The last thing I heard was that @edolstra didn't like it, because it added 12% overhead: #10721 (comment). I didn't measure the overhead of the old fix but it's probably not as bad. |
bump - I just ended up in a situation where I would need to overwrite meta.priority as well. Any thoughts on how this can proceed? |
@gilligan you can use something like this https://github.com/jagajaga/my_configs/blob/master/.nixpkgs/common.nix#L6 |
Is this still relevant, now that we have |
Well, #7425 is still open, but yeah this PR is pretty much useless now. |
I checked a few uses of overrideDerivation; the majority did not change at all, while the ones that had
builder = {bash}/bin/sh
becamebuilder = {bash}/bin/bash
(i.e.stdenv.shell
). But there could be some breakage.