mkDerivation does not recognize git folder

I have a very simple mkDerivation function, which some of the members on Discourse helped me setup :wink:

However, when I run nix-build, I get these errors:

fatal: not a git repository (or any parent up to mount point /) 
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). 
fatal: not a git repository (or any parent up to mount point /) 
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

The build written by the author for this package requires downloading other git repos withing the build folder, and therefore relies on git working. This error puzzles me, and I am not sure how to fix it. I could not find any documentation on GIT_DISCOVERY_ACROSS_FILESYSTEM related to NixOS (I also just tried to set it to 1, but nothing seems to help). Some demystification of this can help me out alot.

Per a StackOverflow question it sounds like you want leaveDotGit = true in your fetch (example).

1 Like