Hi,
I have base flake A providing all packages (some libraries + packages built with those libraries).
In second flake B, I want to use the same packages as provided by A, but with one library (originally provided by A) built in different version and all packages from A rebuilt with this library version.
but what I get in shell is my-pkgs.my-custom-lib in correct version as specified by overlay, but my-pkgs.package which depends on my-custom-lib is not rebuilt.
I could imagine that package.extend(...) only extends the resulting attribute set. I.e., my-pkgs.package.my-custom-lib might be the correct version that you specified in the overlay. However, that is only the output of the derivation, and not the input. For that I would assume you have to use overrideAttrs(...) (Overriding | nixpkgs) as usual.
But this would require you to split your flake into two flakes, one that builds your custom lib (my-custom-nixpkgs) and another one that combines them.
Both have their advantages/disadvantages, and I somehow assume there is a better solution, but these would be my ideas.
I think I forgot to mention one important thing that if I extend nixpkgs input in the exactly the same way
my-pkgs = nixpkgs.legacyPackages.${system}.extend (overlay); # doesn't need makeExtensible, it is nixpkgs are extensible by default
it works as I would expect. my-custom-lib is in custom version and all packages from flake-A are rebuilt against new version of my-custom-lib.
So the question is why adding the overlay to nixpkgs.legacyPackages.${system} behaves differently than doing the same to the flake-A.packages.${system} (after it is made extensible by using makeExtensible ).
Combining flake-A provided overlay (containing all packages) with flake-B created overlay with my-custom-lib using composeManyExtensions doesn’t make any difference ?
That’s not “exactly the same way”. nixpkgs is already extensible by construction. You can’t impose that after the fact when the dependency relationships have already been fixed.
Essentially what your makeExtensible call did was just create a “package set” with no interdependency between the attributes.
Anybody with some idea what else I can try to achieve my goal without manually rebuilding all packages using override <package>.override { my-lib = my-custom-lib} ?