How to override `buildFeatures` in Rust package

After messing around with it on and off and finally discovering this post that pointed me towards looking at the source code for buildRustPackage, I discovered that the attribute I needed to override was cargoBuildFeatures, not buildFeatures.

I was able to enable bat’s lessopen feature with this:

final: prev: {
  bat = prev.bat.overrideAttrs (oldAttrs: {
    cargoBuildFeatures = (oldAttrs.cargoBuildFeatures or [ ]) ++ [ "lessopen" ];
  });
}
2 Likes