`fetchGit` and `fetchGitHub` with sparse checkout?

I am trying to create a derivation for gleam, a statically typed language on the BEAM-VM.

The compiler itself is currently written in Rust while the stdlib is written in Gleam itself and compiled on demand for each project, traditionally managed through rebar3, the same buildsystem used for erlang as well.

My idea was to start by providing the compiler itself to nixpkgs, such that the current BEAM-modules can be used to pull the stdlib from hex. But small steps first, the compiler needs to be available first.

But currently the compiler and the stdlib are in the same repository in sibling folders.

The root folder of the project contains a Makefile and I hoped I could just use the default builder, but it fails because of missing permissions then.

But since the install target basically is just doing cargo install in a sub folder, I wanted to do a “sparse” checkout of the sources and just use rustPlatform.buildRustPackage, but I can’t find a way to do so…

I’m not sure why you need a sparse checkout, can you not just fetch the whole repo and then change the sourceRoot to point to the subfolder (or define setSourceRoot if you can’t predict the overall root folder of the checkout).

To be honest, I have no clue what you are talking about here :smiley:

Though I remembered having read that whatever is returned by fetchFromGitHub coerces into a string representing a path to the source, so I just did src = "${fetchFromGitHub { … }}/gleam" and it seems to build.