fetchGit and fetchgit are not working for private repos with submodules

My problem is that fetchGit can do some things and fetchgit can do some other set of things. But at some point I need capabilities of both in my nix-build :neutral_face:

I have private git repo which have private git submodules and so far I figured out that

fetchGit {
  url = "git@github.com:org/repo.git";
  rev = "rev";
}

fetches private repo, but build will fail because of missing private submodules. And btw fetchSubmodules = true option is not accepted by nix 2.3.4

I tried fetchgit as well

fetchgit {
  url = "git@github.com:org/repo.git";
  rev = "rev";
  sha256 = "sha256";
  deepClone = true;
}

It seems deepClone is valid option, but it even can’t fetch initial private repo and fails with error

Could not create directory '/var/empty/.ssh'
1 Like

Submodule suppport for builtins.fetchgit was just recently merged into Nix: Add fetchSubmodules to builtins.fetchGit by blitz · Pull Request #3166 · NixOS/nix · GitHub

So this will still take some time to show up in a released version of Nix.

2 Likes