-
Notifications
You must be signed in to change notification settings - Fork 728
flake: add Nix flake for reproducible builds #1096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Enable building rustfs with Nix package manager. It allows using rustfs on x86_64-linux, aarch64-linux, x86_64-darwin, and aarch64-darwin. Upstream (nixpkgs) can later adopt this package definition to provide cached builds for users of Nix. The next step is to add a NixOS module. I have a stub one already in my niks3 binary cache that I use for [testing](https://github.com/Mic92/niks3/blob/8fbef7d5a3d551d0f1dc663fe91f94c3e3edf85e/nix/checks/nixos-test-niks3.nix) that would need some love to be upstream-worthy (i.g. I hard-code s3 credentials)
|
waiting for all builds on all systems to finish. |
|
Hey @Mic92 , |
|
I tested this on:
What scope of NixOS integration do you want to have?
|
|
Hey @Mic92 , Our goal is simply to allow NixOS users to get RustFS (SNSD) up and running quickly. For advanced RustFS needs, we prefer to direct users to consult experts like you for commercial support. I believe that is the most reasonable approach. However, if you have a better suggestion, we would value your professional advice on this. Thank you! |
I split the docs out into a separate PR, so details can be discussed here: #1103 |
There was a problem hiding this 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 flake support to enable reproducible builds of RustFS across multiple platforms (x86_64-linux, aarch64-linux, x86_64-darwin, and aarch64-darwin). The implementation provides a standard Nix package definition that can be integrated into nixpkgs for cached binary distribution to Nix users.
Key Changes:
- Adds
flake.nixwith complete build configuration using Rust Platform - Includes properly configured dependencies (protobuf, pkg-config, openssl)
- Provides
flake.lockpinning nixpkgs to a recent unstable snapshot
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| flake.nix | Defines Nix flake with rustPlatform.buildRustPackage configuration, supporting 4 platform architectures with appropriate build dependencies and metadata |
| flake.lock | Locks nixpkgs-unstable dependency to a specific revision (Dec 9, 2025) for reproducible builds |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "rustfs" | ||
| ]; | ||
|
|
||
| doCheck = false; |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are disabled during the Nix build with doCheck = false. Since the project has comprehensive test coverage across multiple crates, consider enabling tests in the Nix build. If tests are disabled due to specific requirements (e.g., external dependencies, network access, or long build times), this should be documented in a comment explaining the rationale.
Enable building rustfs with Nix package manager.
It allows using rustfs on x86_64-linux, aarch64-linux, x86_64-darwin, and aarch64-darwin. Upstream (nixpkgs) can later adopt this package definition to provide cached builds for users of Nix.
The next step is to add a NixOS module. I have a stub one already in my niks3 binary cache that I use for testing that would need some love to be upstream-worthy (i.g. I hard-code s3 credentials)
Type of Change
Related Issues
Summary of Changes
Checklist
make pre-commitImpact
Additional Notes
Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.