I have a simple CMake based flake that as the ‘openscenegraph’ package as one of its buildInputs. I want to be able to use this flake in several other flake based projects. All good so far, now, one of the consumers of this flake has a modified openscenegraph (via an overlay) that it’s using. I want to be able to use this same modified openscenegraph in the first flake. However, when I simply add the first flake as an input to the second, the first flake picks up the non-patched openscenegraph instead of the “overlayed” one. It seems like if I want the input flake to use my overlay, I need to pass a modified Nixpkgs to it in some way? Any idea how to do this or is there another way to handle this?
More specifically, whatever you’re doing in packages.<system>.openscenegraph is using its own nixpkgs instance (which you’ve created via import nixpkgs { ... } or nixpkgs.legacyPackages.<system>).
Overlays only apply to a specific instance of nixpkgs.
If you want to share instances you’ll have to expose overlays.<name> in the producing flake, and then use that overlay in the consuming flake.