I believe you can use buildGoxxxModule where xxx is the version you need. In this case, for Go 1.23:
app = pkgs.buildGo123Module {
pname = "elections";
version = "0.1.0";
src = ./.;
vendorHash = null;
};
You can also keep the buildGoModule input and just override that when calling the package:
elections = callPackage package.nix {
buildGoModule = buildGo123Module;
};
Aside from this, you might be able to accomplish the same thing by overriding the go input of buildGoModule:
elections = callPackage package.nix {
buildGoModule = buildGoModule.override { go = go_1_23; };
};
You should either search for how other people are doing this in nixpkgs or how the thing you’re looking for is being defined. In both cases, fuzzy searching will help you a lot, so I recommend you figure out how to use that with your favorite IDE, or you can use the GitHub search (which might not be as powerful).
For this particular question, I searched for buildGoModule = and I found a lot of instances of buildGoModule = buildGoxxxModule. A little more digging then led me to the go module definition, which has the go input that you can override.