Selecting and overriding cargo features in Rust Packages

Ahoy there!

Can I somehow set (or override, more specifically) the features selected by cargo for building a Rust package using rustPlatform.buildRustPackage?


Context:
I’m currently using i3status-rs as statusbar for my i3. Since I am using notmuch for handling my mail, I want to use the respective block in my statusbar to show me how many mails match a certain query. This however requires the statusbar to be built with a special feature flag.
I thought it would be easiest if I could simply use the package provided by the 20.09 channel of NixOS and just throw the notmuch flag into the package override section.

Can this work? And if so: How? Or did I make wrong assumptions here?

should be:

  cargoBuildFlags = [ "--features=notmuch" ];

EDIT:
This looks to have already been added in unstable, but is missing in release-20.09

Ah, thank you very much for this hint. So now, I can basically just replace i3status-rust in my service.xserver.windowManager.i3.extraPackages with this expression:

(i3status-rust.overrideAttrs ( oldAttrs: { cargoBuildFlags = [ "--features=notmuch" ]; }))

But as this requires rebuilding the expression from source after each update: Is there a chance this could be backported to release-20.09? Or is there a policy against that?

That’s a legitimate complain, you could file a PR and cc the maintainer.

As the 20.09 release manager, I’m just concerned about regression on the stable channel. As this is likely a backwards compatible change, I’m open to having it in 20.09. Please follow https://github.com/NixOS/nixpkgs/blob/ed0d6be5ec5dd9ef07ce9f49053814bced300754/.github/CONTRIBUTING.md#backporting-changes when backporting changes