I haven’t tried this but you can probably hack it with something like
src = (fetchFromGitHub {
owner = "foo";
repo = "bar";
rev = "revision here";
sha256 = "hash here";
fetchSubmodules = true; # needed to use fetchgit internally
leaveDotGit = true; # needed to preserve the .git dir
postFetch = ''
git lfs init
git lfs fetch
# anything else needed to check out lfs files
# possibly delete .git now
'';
).overrideAttrs (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [ git-lfs ];
});
It’s probably a little cleaner to skip fetchFromGitHub
and call fetchgit
directly.
You could also try something that wraps builtins.fetchGit
, though that doesn’t take a postFetch
script so you’d have to use it as the src
for a wrapper derivation and hope that it preserves the .git
dir (which I honestly have no idea if it does).
And finally, you could also consider submitting a PR that adds native git-lfs support to fetchFromGitHub
or fetchgit
directly.