Skip to content

chore: Add nix development environment#6314

Open
kuznetsss wants to merge 16 commits intoXRPLF:developfrom
kuznetsss:Add_nix_devshell
Open

chore: Add nix development environment#6314
kuznetsss wants to merge 16 commits intoXRPLF:developfrom
kuznetsss:Add_nix_devshell

Conversation

@kuznetsss
Copy link
Contributor

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 .gitignore file.

Type of Change

  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)

Copilot AI review requested due to automatic review settings February 2, 2026 17:23
@kuznetsss kuznetsss requested a review from mathbunnyru February 2, 2026 17:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copilot AI review requested due to automatic review settings February 2, 2026 17:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copilot AI review requested due to automatic review settings February 2, 2026 17:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, ... }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a pre-commit for .nix files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a simple bash script and a formatter in flakes

Copy link
Contributor

@mathbunnyru mathbunnyru Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kuznetsss kuznetsss requested a review from vvysokikh1 February 3, 2026 11:17
Copilot AI review requested due to automatic review settings February 3, 2026 14:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI review requested due to automatic review settings February 4, 2026 11:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants