pkgs.runCommand "derivationname" { buildInputs = [ git ]; outputHashMode = "recursive"; outputHashAlgo = "sha256"; outputHash = "blah"; } '' mkdir $out cd $out git clone foobar git submodule update —init —recursively rm -rf .git ''