Propagating environment variables out to dev shell

Some dependencies benefit from having environment variables set, which if not set lead to failures during non-nix cargo build. A mechanism using propagatedBuildInputs was implemented. It creates a shim derivation that is then funneled through propagatedBuildInputs.

This causes predictable issues as the dependency tree gets larger. mkShell doesn’t do any de-duplication is one issue exacerbated by this abuse. The symptoms show up with 4-500kb shells in this case. I’m uncomfortable with using shim derivations & propagatedBuildInputs.

What are some cleaner ways to get these variables set for the relevant crate builds and then to pick up the information to pass to mkShell? Can I just deep-traverse all derivations from inputsFrom and inspect them for a unique key? Is there a better way provided I just haven’t seen yet? Thanks.