For your first problem, I think you might be able to just use the commit hash instead of the branch name.
But I’ve never used your inline home-manager method, instead I’ve used this in my configuration.nix
:
nixpkgs.overlays = [
(self: super: {
# https://github.com/NixOS/nixpkgs/pull/87797
nomachine-client = (import (builtins.fetchTarball {
url =
"https://github.com/NixOS/nixpkgs/archive/4f7a8b4b37de6c7a2c3c689ff7202069fc5832d1.tar.gz";
sha256 = "08sghr19nas4mb74k88mvy4sq9zgb9m15lp0l11y56vx142j3lzg";
}) { config = { allowUnfree = true; }; }).nomachine-client;
})
];
In this example it’s from NixOS org on GitHub, but it could be your own repo as well. I tend to do this for each package versus creating my own fork of nixpkgs and continually merging there.