Accessing a private GitHub repo using builtins.fetchGit?

Just now realizing that I run:

sudo nixos-rebuild switch --flake ~/.nix-config/#

Running as sudo isn’t going to use the ~/.ssh/ config, but instead /root/.ssh. I put my key in /root/.ssh and this is fixed, but I guess I should ask: what’s the recommended approach for downloading private repos during a nixos-rebuild? Should nixos-rebuild run as sudo?

NixOS manual doesn’t mention running sudo when using nixos-install or nixes-rebuild… Hmm.

3 Likes