Nix flake private repos

I’m trying to use a private repo, let’s say github.com/foo/bar, as an input to a Nix flake.

Setting a github access token in .config/nix/nix.conf:

access-tokens = github.com=ghp_...

Works as normal with github:foo/bar as a flake input.

But I’d rather rely on my existing ssh authentication rather than having to create and maintain access tokens.

git+ssh://git@github.com/foo/bar.git, as suggested in:

Doesn’t work:

$ nix build
fetching Git repository 'ssh://git@github.com/RyanGibb/cv.git'fatal: couldn't find remote ref refs/heads/master
error: program 'git' failed with exit code 128

Any suggestions?

1 Like

Well, I solved that rather quickly, the branch is main not master

1 Like