I made two demo implementations of Gentoo-like use-flags (https://github.com/NixOS/nixpkgs/issues/12877) for nixpkgs:
- Undesirable one https://github.com/NixOS/nixpkgs/pull/56109
- The, IMHO, desirable one https://github.com/NixOS/nixpkgs/pull/56110 that needs some more work (and, hence, consensus on merging that work to nixpkgs in the first place).
https://github.com/NixOS/nixpkgs/pull/56110 also has all the technical details and thoughts on the topic.
Any thoughts are welcome here or there.