mirror of
https://github.com/XRPLF/clio.git
synced 2026-10-09 05:18:58 +00:00
build: Reuse nix from xrpld in Clio (#3247)
This commit is contained in:
5
.envrc
Normal file
5
.envrc
Normal file
@@ -0,0 +1,5 @@
|
||||
use flake
|
||||
|
||||
# Optional, untracked local overrides. To use a different shell, put e.g.
|
||||
# `use flake .#gcc` in .envrc.local.
|
||||
source_env_if_exists .envrc.local
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -14,3 +14,7 @@ CLAUDE.md
|
||||
.claude/**
|
||||
.agents/**
|
||||
.augment/**
|
||||
# Direnv's directory
|
||||
/.direnv
|
||||
# Direnv's local, per-developer overrides
|
||||
/.envrc.local
|
||||
|
||||
@@ -12,7 +12,18 @@
|
||||
- [**Optional**] [CCache](https://ccache.dev/): speeds up compilation if you are going to compile Clio often
|
||||
|
||||
We use the Nix-based Docker image `ghcr.io/xrplf/xrpld/nix-ubuntu` to build `Clio`, see [Building Clio with Docker](#building-clio-with-docker).
|
||||
This image is produced by [rippled](https://github.com/XRPLF/rippled) and ships the compilers and tools listed below.
|
||||
This image is produced by [xrpld](https://github.com/XRPLF/rippled) and ships the compilers and tools listed below.
|
||||
|
||||
The same environment is available locally as a [Nix](https://nixos.org/) dev shell, reused from `xrpld` through [`flake.nix`](../flake.nix):
|
||||
|
||||
```sh
|
||||
nix develop # Clang on macOS, GCC on Linux
|
||||
nix develop .#clang # or .#gcc, .#apple-clang
|
||||
```
|
||||
|
||||
The shell uses its own Conan home, `~/.conan2-nix`, and sets it up on entry.
|
||||
With [direnv](https://direnv.net/), run `direnv allow` once to enter the shell automatically, using the provided `.envrc`.
|
||||
See [xrpld's Nix guide](https://github.com/XRPLF/rippled/blob/develop/docs/build/nix.md) for more details.
|
||||
|
||||
The following compiler version are guaranteed to work.
|
||||
Any compiler with lower version may not be able to build Clio:
|
||||
@@ -31,7 +42,7 @@ You can change it by using `$CONAN_HOME` env variable.
|
||||
|
||||
> [!TIP]
|
||||
> To setup Conan automatically, you can run `conan/init.sh`.
|
||||
> This will delete Conan home directory (if it exists), set up profiles and add Artifactory remote.
|
||||
> This will set up the global configuration and profiles, and add the `xrplf` remote. It never deletes the Conan home directory.
|
||||
|
||||
The instruction below assumes that `$CONAN_HOME` is not set.
|
||||
|
||||
|
||||
86
flake.lock
generated
Normal file
86
flake.lock
generated
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1791130267,
|
||||
"narHash": "sha256-1sjwcQMcgAbmiip/VivBSiK8p2bTkQGOvCuO7vnwfx4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9013764fcc0ea99fa16cf7aa7decf8a5c3889dd2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-custom-glibc": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1593520194,
|
||||
"narHash": "sha256-+TZW+2I7kLL9JglPNOagm1ywjf9ua0JYGoptq/dzVn0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9cd98386a38891d1074fc18036b842dc4416f562",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9cd98386a38891d1074fc18036b842dc4416f562",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"xrpld": "xrpld"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"xrpld",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791189933,
|
||||
"narHash": "sha256-Y8eN7ki0Urx4Ojf4w1xSpWg8uk/3lJqK+E0Oth77rH0=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "e60029353d0c48d216bc4b065168ccd4079c166f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"xrpld": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-custom-glibc": "nixpkgs-custom-glibc",
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791321597,
|
||||
"narHash": "sha256-AhcXqET1GyR9wp2ae0fdadZzRPpSB8KSLASwjMMthBQ=",
|
||||
"owner": "XRPLF",
|
||||
"repo": "rippled",
|
||||
"rev": "3d526d456ecd54dfb83d34eda54f5e88df840d79",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "XRPLF",
|
||||
"repo": "rippled",
|
||||
"rev": "3d526d456ecd54dfb83d34eda54f5e88df840d79",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
18
flake.nix
Normal file
18
flake.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
description = "Nix related things for Clio";
|
||||
|
||||
inputs = {
|
||||
# Clio is built with the same toolchain as xrpld, so its dev shells are reused as is.
|
||||
# Keep the revision in sync with the `ghcr.io/xrplf/xrpld/nix-ubuntu` image used in CI,
|
||||
# so the local shell matches CI.
|
||||
# Its nixpkgs is deliberately not overridden with `follows`:
|
||||
# that would change the toolchain and lose the match with CI.
|
||||
xrpld.url = "github:XRPLF/rippled/3d526d456ecd54dfb83d34eda54f5e88df840d79";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ xrpld, ... }:
|
||||
{
|
||||
inherit (xrpld) devShells formatter;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user