I found this reddit thread on r/NixOS https://www.reddit.com/r/NixOS/comments/180ejh0/nixos_and_glibc/
It seems like some folks in the nix community took a look at the install instructions and were a bit confused about how installing for nix was explained. This comment clarifies things pretty well
I'm pretty sure you can use it just fine on nix and nixos. The warning is just for the prebuild nightlys that are built for a standard fs layout and won't run on nix without a bit of extra work.
I'm curious if @John Murray or anyone else with more nix experience has thoughts on how we could improve the install docs so nix-heads don't get confused.
Yes that comment is pretty accurate.
Basically you would need to make a custom derivation which wraps the binary to setup paths to all the dynamic libs.
This is pretty common for most binaries when using nix.
I don't think it would be too hard to setup our own wrapping. I'll take a stab at it so people who just wanna use roc with a full build from source can mess around
The we could maybe just call out "we have a nix derivation here" instead of the caveat
I usually build from source with nix-build https://github.com/roc-lang/roc/archive/main.tar.gz
, is what you're proposing particularly different from that?
Yes, John's solution would patch the existing nightly binary, whereas nix-build builds completely from source.
for what it's worth, we're working on getting roc building with static musl instead of dynamic glibc but it's nontrivial to say the least :sweat_smile:
yeah, patching the binary for nix should be a lot easier :p
I'll see if I can get that working soon
I got a basic derivation working for wrapping the pre compiled binary https://github.com/JRMurr/roc/blob/nix-wrapped-nightly/nix/nightly/default.nix
The issue i realized though is if we had that checked in we would need to update the sha each day...
The other issue is since we dont have multiple nightly versions hosted people would also need to update the sha each day
people can do this right now and it will get all the needed deps
nix-shell -p steam-run
steam-run <downloaded-roc-binary>
I like we mostly got "well actually"ied so maybe we just add a dedicated nixos section on the installer and get rid of the cavets on nix elsewhere?
some info on binaries with nix here for those curious
I can touch up the docs for that
Thanks for helping out with this @John Murray!
The other issue is since we dont have multiple nightly versions hosted people would also need to update the sha each day
Would a roc nix overlay help here?
yea we could do something like how the rust overlay works and have a seperate repo that pins to each day's commit.
Though IMO most nix expressions build from source so using our default.nix or flake outputs should be fine if people want to use roc for builds.
If they want to just play around without compiling the steam run approach works without any effort from us
Though IMO most nix expressions build from source so using our default.nix or flake outputs should be fine if people want to use roc for builds.
I think for CI the overlay would be valuable. Building from source can be quite time consuming on less powerful CI machines. They also could use steam-run but I think more people will be familiar with overlays.
John Murray said:
I can touch up the docs for that
This would be great by the way :)
Last updated: Jul 06 2025 at 12:14 UTC