How to prevent a overlay from being applied more than once?

You could add a marker to nixpkgs to check if the overlay has been applied already:

let
  overlayFoo = super.lib.optionalAttrs (!super.__fooHasBeenApplied or false) {
    __fooHasBeenApplied = true;
    # …
  };
in
#…

It is probably simpler to get rid of the composeExtensions though.

1 Like