nix flake new --template github:lenianiva/Manifest2Nix.jl#simple ./simple
cd simple
nix build
This builds a simple Julia library and runs a random sampling experiment, with the output of the experiment written at result.
> cat result
1.0480426577669817
It uses Nix to sandbox a environment for Julia to ensure reproducibility. The resulting Nix derivation can also be piped into docker images for running on shared computing clusters.
This library also provides a Julia executable based on an input manifest version.
Looks great. I see that you’re using julia-bin for the executable, which I agree seems to be the way to go, although I am still mystified why julia doesn’t build nicely on nix.
Do you know if there’s any way forward to have nice precompile hashing as part of the nix flake as well? It would be awesome to be able to run nix run mychannel#juliaflake and have it pull in the dependencies alongside the precompile targets so that everything runs quickly.
This avenue becomes even more interesting with the julia 1.12 apps. I think runic could be an interesting case study for this, how fast (TTFX) one can run a julia app on a fresh nix-available machine.
I’m not using julia-bin as the executable. It is one of the options available, but I encourage people to use the manifest version overlay since Julia version could be finely adjusted.
if you want to precompile all the depots and cache them in Nix, use
Regarding building from source, I have a plan to build from source, and I think it is doable within Nix. However just looking from rust-overlay and lean4-nix, it seems like not many people care about source builds.