How to override stdenv for a specific graph

Hello!

I’d like to override stdenv for a package + all of it’s dependencies (i.e. shared libraries).
For instance, enableDebug, I’d like to turn it on for a pkg and it’s dependencies but not have to rebuild all the tools used to build it.

Is this possible via some gesture in nixpkgs?

Thanks!

Just to be clear, when you say you don’t want to build rebuild all the tools, you mean that you want to set something like enableDebug (or any other arbitrary config overrides) for only the package and its direct dependencies, but not the dependencies’ dependencies, and so on?

I was wondering if I could control setting the flags for a set of packages in a graph (or even the whole graph).

Right now I can either set it on a single package or maybe override stdenv which then modifies everything including the build tools.

I’m only interested in the application + it’s runtime dependencies in the case of enableDebug for instance.

I personally don’t know of any standard tools that would let you do that. You could try playing around with overriding to approach something useful. Maybe something like this?

myPackage.overrideAttrs (prev: { buildInputs = map enableDebugging prev.buildInputs; })

# or maybe

myPackage.overrideAttrs (prev: {
  buildInputs = map (drv: drv.overrideAttrs { separateDebugInfo = true; }) prev.buildInputs;
})