Skip to content

Evaluate Athens proxy for private Go modules in Nix sandbox #136

Description

@LarsArtmann

Context

Currently, 4 private repos cannot be fetched inside the Nix sandbox:

  • github.com/larsartmann/go-cqrs-lite (most-used: ~950 imports across codebase)
  • github.com/larsartmann/go-finding (49 imports)
  • github.com/larsartmann/go-structure-linter
  • github.com/LarsArtmann/go-commit

The Go public proxy (proxy.golang.org) returns 404 for these. In the Nix sandbox (no SSH keys, no git auth), buildGoModule's go mod vendor fails:

fatal: could not read Username for 'https://github.com': terminal prompts disabled

Impact

~10 projects have vendorHash = lib.fakeHash because they can't compute the real hash:

  • accountability-system
  • Kernovia
  • auto-deduplicate
  • e-invoicing (demo-server)
  • BuildFlow (external tools)

Current workaround: go build ./... for local dev (no nix build).

Why GOPRIVATE Was Already Fixed

The old GOPRIVATE=github.com/LarsArtmann/* wildcard was narrowed to only the 4 private repos in home-base.nix. The 7+ public repos (go-branded-id, go-error-family, go-output, httputil, templ-components, gogenfilter, samber-do-auditlog) now download from proxy.golang.org normally.

Proposed Solution: Athens

Athens is a self-hosted Go module proxy that:

  1. Fetches modules from GitHub via a configured token (SSH or PAT)
  2. Caches them permanently to disk/S3
  3. Serves them over plain HTTP — no SSH keys needed in the sandbox
Nix sandbox (no SSH) → Athens (has GitHub PAT) → GitHub
                            ↓
                      Cache (never re-fetches)

Setup Options

Option A: NixOS module on evo-x2

services.athens = {
  enable = true;
  storageType = "disk";
  config = {
    GithubTokenFile = "/run/secrets/athens-github-token";
  };
};

Then set in project flakes:

overrideModAttrs = _: {
  GOPROXY = "https://athens.lars.software,https://proxy.golang.org,direct";
};

Option B: Make the 4 repos public (simplest if no secrets in history)

Option C: Keep vendorHash = null + committed vendor/ dirs (what project-dependency-graph and bank-sync already do, but vendor dirs can be 200MB+)

Decision Needed

  • Evaluate Athens vs making repos public
  • If Athens: which host, what storage backend, auth strategy
  • If public: audit for secrets first

References

  • Full analysis: docs/nix-flake-review-2026-07-10.md
  • Athens docs: https://docs.gomods.io
  • Affected projects: accountability-system, Kernovia, auto-deduplicate, e-invoicing, BuildFlow

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions