`builtins.getFlake` & shallow repo?

error: ‘/path/to/repo’ is a shallow Git repository, but shallow repositories are only allowed when shallow = true; is specified.

What I’ve tried:

  • builtins.getFlake "git+file:///path/to/repo?shallow=true" - not working
  • builtins.getFlake (builtins.fetchTree { type = "git"; url = "file:///path/to/repo"; shallow = true; }) - not working
  • removing .git/shallow - not working

The only workaround that works: adding fetch-depth: 0 for actions/checkout@v3 in GitHub actions. Are there any other ways to work around this annoying issue?

2 Likes

Works since [Flakes] nix does not work in shallow repositories · Issue #3756 · NixOS/nix · GitHub has been fixed, with ?shallow=1 (not true), eg. builtins.getFlake "git+file:///path/to/repo?shallow=1".

1 Like