Hello! Finally I got some headspace to experiment with Roc. I'm very excited!
To the point. I'm trying to build the first example from the tutorial with Nix, but it is failing to download the platform. Nix prevents network access to keep the build reproducible. What is the recommended way around it? I tried to download the platform file and placed a relative path to it like that packages { pf: "./basic-cli-pltform.tar.br" }
in my main.roc
, but this gives me the following error:
thread 'main' panicked at 'There were still outstanding Arc references to module_ids', crates/compiler/load_internal/src/file.rs:1564:37
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Hi @Tad Lispy,
Can you share the nix code you used?
Sure @Anton. It's here <https://gitlab.com/tad-lispy/roc-language-playground/-/blob/faaf06b8539d696d01ee66446bc1f17e2e655908/flake.nix>.
The development shell works just fine and I can build the program. But nix build
fails with the following:
roc-playground> roc test
roc-playground> Downloading https://github.com/roc-lang/basic-cli/releases/download/0.5.0/Cufzl36_SnJ4QbOoEmiJ5dIpUxBvdB3NEySvuH82Wio.tar.br
roc-playground> into /homeless-shelter/.cache/roc/packages
roc-playground> ── HTTP ERROR ──────────────────────────────────────────────────── UNKNOWN.roc ─
roc-playground> I was trying to download this URL:
roc-playground> https://github.com/roc-lang/basic-cli/releases/download/0.5.0/Cufzl36_SnJ4QbOoEmiJ5dIpUxBvdB3NEySvuH82Wio.tar.br
roc-playground> But I encountered a network error:
roc-playground> error sending request for url (https://github.com/roc-lang/basic-cli/releases/download/0.5.0/Cufzl36_SnJ4QbOoEmiJ5dIpUxBvdB3NEySvuH82Wio.tar.br): error trying to connect: dns error: failed to lookup address information: Temporary failure in name resolutionmake: *** [Makefile:18: test] Error 1
error: builder for '/nix/store/2hipbms0cpkdr57djmd3kl40h0vsalvk-roc-playground.drv' failed with exit code 2;
I see. Your initial approach was close but I'm not sure we support local tar.br files, I'll make an issue for a better error message. You can use "pf: ..." like in this example. In the nix flake you could get the platform using the url https://github.com/roc-lang/basic-cli/commit/3c8a526b99156948f0c060152dcac522c9a6217b for basic-cli 0.5.0 or https://github.com/roc-lang/basic-cli/commit/bb98ddd1cc13eb4bb19c69cb0a42792844e2ef4b for latest main. You will probably also need to include a sha256.
I would not recommend the nix build
approach for regular development right now, build speed will be slow because you need to rebuild the platform every time. I'll also make an issue to support nix build
with the basic-cli flake, which should solve that caching problem.
https://github.com/roc-lang/basic-cli/issues/117
Last updated: Jul 06 2025 at 12:14 UTC