Specify that in nix-shell's PATH, usr/bin needs to come after nix-related components

This was the source of quite a head-scratching error when building the compiler, only solved thanks to @ayazhafiz 's insight. Indeed, compilation of `roc_cli` was failing with an obscure error about linking with `cc` and not being able to find `-ltinfo`. Turns out the fix is as trivial as rearranging nix-shell's `PATH` a little.
I feel like nix-shell will become the default for many users who prefer delegating the necessary setup to the repo's script, and I definitely wish I had known about this when I was starting out.

Is this the right place to mention this or should it be somewhere else in the document?
This commit is contained in:
Nikita Mounier 2022-04-08 20:43:58 +00:00 committed by GitHub
parent 5dc8c852e9
commit fa527b1888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,8 @@ Use `cargo run help` to see all subcommands.
To use the `repl` subcommand, execute `cargo run repl`.
Use `cargo build` to build the whole project.
> In the nix-shell, make sure that inside your `PATH` variable `usr/bin` comes after all the nix-related components. Otherwise you might get some nasty rust compilation errors!
#### Extra tips
If you plan on using `nix-shell` regularly, check out [direnv](https://direnv.net/) and [lorri](https://github.com/nix-community/lorri). Whenever you `cd` into `roc/`, they will automatically load the Nix dependencies into your current shell, so you never have to run nix-shell directly!