Overlays for packages with internal builders

Hi,
I want to learn how to write better overlays for packages that have encapsulated builders.

Recently, I needed a more recent version of Android Studio (Android Studio nixpkgs expression). As I understand, different Android Studio channels are defined in default.nix and are then built using mkStudio function defined in common.nix. Since I just wanted to change the version of the package, the only thing I needed to change was latestVersion attrset. However, I couldn’t think of a way to get the mkStudio function out of the overlay arguments (self, super). So I just copied common.nix file, placed it in .config/nixpkgs/overlays/android-studio folder together with a default.nix file defined like this:

self: super:

let
  mkStudio = opts: super.callPackage (import ./common.nix opts) {
    fontsConf = super.makeFontsConf {
      fontDirectories = [];
    };
    inherit (super.gnome2) GConf gnome_vfs;
  };
  latestVersion = { # canary & dev
    version = "4.2.0.2"; # "Android Studio 4.2 Canary 2"
    build = "201.6582697";
    sha256Hash = "1ga9b7kyczjf690b2rjww1j1bwsc6p4a7xgwj1k5n52w1mcxya3w";
  };
in {
  androidStudioPackages.canary = mkStudio (latestVersion // {
    channel = "canary";
    pname = "android-studio-canary";
  });
}

Even though this approach worked, I can’t help but feel that there is a better way. I guess I could have used something like fetchurl to get the common.nix file. However, I think that in more complex packages, there might be a lot more files than in this case, and fetching all of them could become tedious. So, I wanted to ask if there is perhaps a more convenient way to obtain internal expressions (like mkStudio) for defining overlays.

Thanks in advance.