|
rippled
|
This guide explains how to use Nix to set up a reproducible development environment for xrpld. Using Nix eliminates the need to manually install utilities and ensures consistent tooling across different machines.
Please follow the official installation instructions of nix package manager for your system.
From the root of the xrpld repository, enter the default development shell:
This will:
The first time you run this command, it will take a few minutes to download and build the environment. Subsequent runs will be much faster.
[!TIP] To avoid typing ‘--experimental-features 'nix-command flakes’
every time, you can permanently enable flakes by creating~/.config/nix/nix.conf`:mkdir -p ~/.config/nixecho "experimental-features = nix-command flakes" >> ~/.config/nix/nix.confAfter this, you can simply use
nix developinstead.
[!NOTE] The examples below assume you've enabled flakes in your config. If you haven't, add ‘--experimental-features 'nix-command flakes’
after eachnix` command.
A compiler can be chosen by providing its name with the .# prefix, e.g. nix develop .#gcc15. Use nix flake show to see all the available development shells.
Use nix develop .#no_compiler to use the compiler from your system.
nix develop opens bash by default. If you want to use another shell this could be done by adding -c flag. For example:
Once inside the Nix development shell, follow the standard build instructions. The Nix shell provides all necessary tools (CMake, Ninja, Conan, etc.).
direnv or nix-direnv can automatically activate the Nix development shell when you enter the repository directory.
Please note that there is no guarantee that binaries from conan cache will work when using nix. If you encounter any errors, please use ‘--build ’*'` to force conan to compile everything from source:
To update flake.lock to the latest revision use nix flake update command.