nix-private-go-repos
Installation
SKILL.md
Private Go GitHub Repositories in Nix
Private Go modules (github.com/LarsArtmann/*) cannot be fetched inside the Nix sandbox. The common workaround is committing a vendor/ directory, which produces massive diffs, stale dependencies, merge conflicts, and bloated repositories. A better approach is mkPreparedSource + GOPRIVATE.
You need both parts:
mkPreparedSourcefor hermeticnix build— it copies private deps into the source tree and injectsreplacedirectives before the build derivation.GOPRIVATEin devShell for local development — it stopsgo mod tidy/go getfrom hitting the public Go proxy for private paths.
Verification status (read first)
All claims verified against
go-nix-helperssource (as of 2026-08-12):
GOPRIVATE,vendorHash,buildGoModule,replacedirectives, andgit+ssh://flake inputs are public, documented Nix and Go concepts.- The
mkPreparedSourcefunction, theflakeModules.go-standardmodule, and their specific APIs (depsmap,validatePrivateDeps,publicDeps,postPatchExtra,privateGlobPattern,requireDeps) are confirmed against the current source in/home/lars/projects/go-nix-helpers.- The
go-standardmodule has 39 options total; this skill covers the subset relevant to private-dep management.- The problems with committed
vendor/(massive diffs, stale deps, merge conflicts) are well-known and widely documented.