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

Allow overriding underlying buildRustCrate invocation #77

Open
kolloch opened this issue Jan 27, 2020 · 0 comments
Open

Allow overriding underlying buildRustCrate invocation #77

kolloch opened this issue Jan 27, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@kolloch
Copy link
Collaborator

kolloch commented Jan 27, 2020

I want to make it easy to build a crate with default features etc but also to customize it. So far, I have allowed this by providing .build attribute which contains the derivation with the default arguments. That derivation is returned by buildRustCrateWithFeatures which uses makeOverridable to allow overriding its paramters.

Unfortunately, buildRustCrate in nixpkgs also uses makeOverridable to allow customization. Sometimes, it might be good to customize the derivation on that level.

I can think of multiple ways to achieve this:

  1. Instead or in addition of the build attribute, I would introduce a builder attribute which is a function that you can call with an empty attr set {} to get the old behavior -- or specify additional parameters to override behavior.
  2. Add an overridable buildRustCrateOverride parameter to buildRustCrateWithFeatures. That parameter would contain a function which is passed to override on the buildRustCrate return value. E.g.:
    {/*...*/}.build.override {
        buildRustCrateOverride = (oldAttrs: {/*...*/});
    }
  3. Maybe in addtion to 2 have a convenience .overrideBuildRustCrate function which crates an override on buildRustCrate using 2 or similar.

Tell me if that sounds like a good plan.

@kolloch kolloch added enhancement New feature or request breaking change labels Jan 27, 2020
@kolloch kolloch added this to the 0.8 milestone Jan 27, 2020
@kolloch kolloch changed the title Do not use override anymore for customizing buildRustCrate Allow overriding the returned deriviations with .override Jan 27, 2020
@kolloch kolloch changed the title Allow overriding the returned deriviations with .override What is a good .override pattern? Jan 27, 2020
@kolloch kolloch changed the title What is a good .override pattern? Allow overriding underlying buildRustCrate invocation Jan 27, 2020
@kolloch kolloch modified the milestones: 0.8, 0.9 Mar 29, 2020
@kolloch kolloch removed this from the 0.9 milestone Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant