Issue w/ flake in private git repo

Running into a rather weird issue w/ flakes that I’m not able to debug further myself.

I recently switched to a new laptop (running NixOS-unstable updated in the last few days) and I had a flake that was depending on another flake from a private GitLab repo. This was previously working successfully and currently works on others machines.

The error messages are… vague but I do see fatal: not a git repository: '.' printed as well as a nix trace that says: error: program 'git' failed with exit code 128. I’ve verified that I’m able to successfully clone the repo via the git command. My best guess is that it is somehow related to failed auth, but I’m unable to diagnose that or resolve it.

To further attempt debugging I created a brand-new testuser and followed these steps:

  • created a new user (w/ useradd)
  • copied the ssh keys so the new user could checkout the repo
  • cloned the repo
  • attempted to enter a dev shell
  • nix prompted for auth on updating the private flake and hung (which I thought was fixed in nix 2.17.0)
  • so I mashed enter a few times to bypass the hidden SSH prompt
  • ran eval $(ssh-agent -s) and ssh-add keyfile
  • and … everything works fine. ?!

The weirdness is that the user which cannot use the private flake has always used flakes on this new laptop, whereas the new user I just created does not and any needed packages for the test were installed nix-env.

This reminded me of an issue during installation on this laptop wherein I had an odd problem with nixos-install didn’t correctly create the /nix/var/nix/profiles/per-user/jboyens directory to store the manifest.json in. I eventually worked around that, but I’m wondering if something got into a weird state…

AND, we have resolution:

Seems when I rsync’d some files from the old laptop to the new one I captured some of $XDG_CACHE_HOME/nix.

Upon running the nix command with --debug I was able to identify probable culprit and I eradicated the nix cache from $XDG_CACHE_HOME.

It was then able to successfully pull and all is well.

1 Like