What you are trying to do doesn't look like an overlay, but an override[1].
you can do something like this:
let
new_electrum = pkgs.electrum.overrideAttrs (oldAttrs: rec {
name = "${oldAttrs.pname}-${version}";
version = "4.0.0a";
src = fetchurl {
url = "https://download.electrum.org/${version}/Electrum-${version}.tar.gz";
sha256=pkgs.lib.fakeSha256;
};
})
in
<then use "new_electrum">
Unfortunately there is no https://download.electrum.org/4.0.0a/Electrum-4.0.0a.tar.gz so I don't have the hash. So you would need to perhaps correct it. You could invoke this it will fail with an error that hash is wrong and will provide the file hash, then just replace pkgs.lib.fakeSha256 with the hash in quotes.[1] https://nixos.org/nixpkgs/manual/#sec-pkg-overrideAttrs
Edit: looks like the version is on GitHub, and after I posted seems like you already figured it out, but maybe it can help someone else, typically that's the way to override.