chore: Add nix development environment#6314
chore: Add nix development environment#6314kuznetsss wants to merge 16 commits intoXRPLF:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Nix flakes support to provide reproducible development environments for xrpld. The changes include Nix configuration files, documentation on how to use the Nix development shell, and updates to .gitignore for Nix-related directories.
Changes:
- Adds Nix flake configuration with support for multiple compiler versions (GCC 13-15, Clang 18-21)
- Provides comprehensive documentation for using the Nix development environment
- Updates .gitignore to exclude Nix and direnv artifacts
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| flake.nix | Main Nix flake configuration defining inputs and development shell outputs |
| flake.lock | Lock file pinning nixpkgs version for reproducibility |
| nix/utils.nix | Helper utilities for multi-platform support |
| nix/devshell.nix | Development shell definitions with multiple compiler configurations |
| docs/build/nix.md | Comprehensive guide for using Nix development environments |
| docs/build/environment.md | Added reference to Nix as an alternative setup method |
| .gitignore | Added entries for Nix, direnv, and clangd cache directories |
| .envrc | direnv configuration for automatic Nix shell activation |
| .config/cspell.config.yaml | Added Nix-related terms to spell checker dictionary |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,150 @@ | |||
| { pkgs, ... }: | |||
There was a problem hiding this comment.
Is there a pre-commit for .nix files?
There was a problem hiding this comment.
Added a simple bash script and a formatter in flakes
There was a problem hiding this comment.
Let's add https://github.com/NixOS/nixfmt as a pre-commit hook, and they officially support it: https://github.com/NixOS/nixfmt#pre-commit
This way it:
- will always work, no matter if nix is installed or not
- won't have inline bash
- will give native pre-commit experience
There was a problem hiding this comment.
Their pre-commit hook requires haskell to be installed:
➜ pre-commit run nixfmt --all-files
[INFO] Installing environment for https://github.com/NixOS/nixfmt.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('cabal', 'update')
return code: 1
stdout:
Executable `cabal` not found
stderr: (none)There was a problem hiding this comment.
There is another hook, nixfmt-nix, it requires nix to be installed: https://github.com/NixOS/nixfmt/blob/master/.pre-commit-hooks.yaml
But I think it makes sense to require nix to be installed, if you're changing nix files. And it makes sense to have it installed in CI.
Right now, the codestyle is not enabled on the server-side, which means it's not forced.
61078ae to
1289748
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
High Level Overview of Change
This PR adds a development environment provided by the Nix package manager, along with documentation on how to use it and provides minor updates to the
.gitignorefile.Type of Change
.gitignore, formatting, dropping support for older tooling)