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

make-derivation: put patches in all derivations #59755

Merged
merged 1 commit into from Apr 23, 2019

Conversation

matthewbauer
Copy link
Member

This puts patches in all derivations even if it unspecified by the
derivation. By default it will be an empty list. This simplifies
overrides, as we can now assume that patches is a valid name so that
this works:

self: super: {
  mypkg = super.pkg.overrideAttrs (o: {
    patches = o.patches ++ [ ./my-very-own.patch ];
  });
}

That is, you don’t need to provide a default "or []", make-derivation
provides one for you.

Unfortunately, this is a mass rebuild.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This puts patches in all derivations even if it unspecified by the
derivation. By default it will be an empty list. This simplifies
overrides, as we can now assume that patches is a valid name so that
this works:

self: super: {
  mypkg = super.pkg.overrideAttrs (o: {
    patches = o.patches ++ [ ./my-very-own.patch ];
  });
}

That is, you don’t need to provide a default "or []", make-derivation
provides one for you.

Unfortunately, this is a mass rebuild.
@Ericson2314
Copy link
Member

Ericson2314 commented Apr 17, 2019

Yes! I would like to do this for all standard variables. It is good preparation for structured attrs too.

@matthewbauer could you also go in setup.hs and simplify the variable references, since set -u will no longer get in the way?

@matthewbauer
Copy link
Member Author

There are a few more "standard" flags that often need to be composed. For instance, I would like to put these flags in make-derivation.nix like:

  • buildFlags
  • makeFlags
  • installFlags
  • checkFlags
  • installCheckFlags

We don't want to go too crazy with this. Things like flags for cmake, meson, etc. may not make sense in make-derivation.

@Ericson2314
Copy link
Member

Yes, the more we bake in variables in mkDerivation, the more we should break up mkDerivation into layers like http://sandervanderburg.blogspot.com/2018/07/layered-build-function-abstractions-for.html .

@jtojnar
Copy link
Contributor

jtojnar commented Apr 17, 2019

👍 This will also prevent Linux rebuilds when adding a Darwin-only patch to an expression without patches.

@matthewbauer matthewbauer merged commit 7f23d9f into NixOS:staging Apr 23, 2019
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

4 participants