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

overrideDerivation: fix meta handling #9312

Closed
wants to merge 1 commit into from

Conversation

Mathnerd314
Copy link
Contributor

I checked a few uses of overrideDerivation; the majority did not change at all, while the ones that had builder = {bash}/bin/sh became builder = {bash}/bin/bash (i.e. stdenv.shell). But there could be some breakage.

@lucabrunox
Copy link
Contributor

You should keep using derivation not stdenv.mkDerivation .

@Mathnerd314 Mathnerd314 force-pushed the meta-fix branch 3 times, most recently from d83c09f to 3a73651 Compare August 18, 2015 15:37
@Mathnerd314
Copy link
Contributor Author

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:

myStdenv = stdenv // { mkDerivation = args: derivation (args // { stdenv = myStdenv; }); };

I have updated the commit to be more concise; I forgot that cross-compiling will use stdenv properly.

@Mathnerd314 Mathnerd314 reopened this Aug 18, 2015
@Mathnerd314 Mathnerd314 force-pushed the meta-fix branch 4 times, most recently from 278f4a5 to 788fd51 Compare August 19, 2015 02:40
@Mathnerd314
Copy link
Contributor Author

I ran nox-review locally and it completed successfully (after 278f4a5), so the Travis failure can be ignored.

@Mathnerd314
Copy link
Contributor Author

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.
Perhaps we could move customisation.nix into pkgs/, since NixOS's only use is https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/testing.nix#L181 and that is to override a package. (hydraJob would move to attrSets)

@Mathnerd314
Copy link
Contributor Author

@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).

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.
@jagajaga
Copy link
Member

jagajaga commented Mar 5, 2016

ping all

@Mathnerd314
Copy link
Contributor Author

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.

@gilligan
Copy link
Contributor

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?

@jagajaga
Copy link
Member

@gilligan you can use something like this https://github.com/jagajaga/my_configs/blob/master/.nixpkgs/common.nix#L6

@bennofs
Copy link
Contributor

bennofs commented Apr 21, 2017

Is this still relevant, now that we have overrideAttrs?

@Mathnerd314
Copy link
Contributor Author

Well, #7425 is still open, but yeah this PR is pretty much useless now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants