Add instructions for using the Nix Flake (#547)

<!-- Thank you for submitting this PR! :) -->

## Description

We maintain a Nix Flake for installing project dependencies but do not
advertise or explain it. Hopefully this fixes that.

---------

Co-authored-by: Samir Talwar <samir.talwar@hasura.io>
V3_GIT_ORIGIN_REV_ID: f1c5d471a5d1ffd5fa3ef31a471da7fcc44a935b
This commit is contained in:
Daniel Harvey 2024-05-07 10:54:58 +01:00 committed by hasura-bot
parent 085277491c
commit ce4dd596fb
3 changed files with 34 additions and 1 deletions

View File

@ -6,6 +6,6 @@
# Install direnv, then add anything you'd like to load when entering this
# directory.
#
# See .envrc.example for examples.
# See .envrc.local.example for examples.
source_env_if_exists .envrc.local

View File

@ -32,6 +32,39 @@ cargo build
From here, you can follow the instructions in <README.md> to set up a working
server.
## Installing project dependencies with Nix
We maintain a [Nix Flake](flake.nix) that will install all of the project
dependencies required to work on `v3-engine`.
To use it:
1. [Install Nix](https://github.com/DeterminateSystems/nix-installer)
2. Run `nix develop` in the project root. This starts a new shell which exposes
the Nix project dependencies on your `$PATH`, and can be exited with `exit`.
3. Type `echo $IN_NIX_SHELL` to confirm you're in a Nix shell. It should print
"impure".
4. Run `which rustc` to verify that the Rust compiler is being provided by Nix.
You should see a path starting with `/nix/store/` and ending in `/bin/rustc`.
We also supply configuration for [direnv](https://direnv.net/) to allow
autoloading the Nix dependencies upon entering the project folder.
To use this:
1. Install direnv:
1. [Install the direnv program](https://direnv.net/docs/installation.html)
1. [Add the direnv hook to your shell](https://direnv.net/docs/hook.html)
1. Open a new terminal
1. `cp .envrc.local.example .envrc.local`
1. Run `direnv allow`
1. Nix should now install project dependencies and put them in your `$PATH`
whenever you enter the project folder.
1. Type `echo $IN_NIX_SHELL` to confirm you're in a Nix shell. It should print
"impure".
1. Run `which rustc` to verify that the Rust compiler is being provided by Nix.
You should see a path starting with `/nix/store/` and ending in `/bin/rustc`.
## Architecture
See the [architecture document](docs/architecture.md).