Can an overlay know if it's in pkgs or pkgsMusl?

I like this pattern:

  pkgs = import (fetchTarball
    "") {
      overlays =
        [ (self: super: { unstable = pkgs_unstable; }) (import ./overlay.nix) ];

To add the unstable pkg set as an attribute to quickly get access to unstable packages.
My challenge is then in my overlay if I do the following:

self: super: {
   foo =;

I’m working in the pkgsMusl pkg set, then it seems like I am setting foo to be the glibc version.
(I think normally super would be the pkgsMusl attrset)

Is there a good way to handle this?

Does anyone else use this pattern btw?
i quite like it aside from this limitation.