-
Notifications
You must be signed in to change notification settings - Fork 3
Add Nix flake for RustFS with NixOS module #1
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
Merged
+200
−2
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
19f5ac2
Initial plan
Copilot d5be4d1
Add flake.nix with NixOS module and overlay
Copilot b92bb2d
Add examples and contributing guidelines
Copilot 6ef242f
Fix security issues: add proper shell escaping and fix StateDirectory
Copilot 71c2aba
Remove placeholder flake.lock, will be auto-generated by Nix
Copilot 41630bb
Add automatic data directory creation and user home configuration
Copilot 8e5fcb6
Add read-only access to config file when specified
Copilot b53697f
Fix dev shell hook and make example consistent with defaults
Copilot a443601
Apply suggestions from code review
houseme 55021e9
Update examples/nixos-configuration.nix
houseme 7763d4c
Fix systemd ExecStart, add StateDirectory, and improve config file ac…
Copilot e4746ea
Fix user/group creation logic to handle mismatched user and group
Copilot c084dee
Fix lib.escapeShellArg and simplify group creation logic
Copilot 5621e68
Improve group creation logic to handle all user/group combinations
Copilot 4244a0f
Merge branch 'main' into copilot/add-rustfs-support-nixos
houseme ba42f2c
feat: optimize NixOS module and enhance examples with console support
houseme 7c3327e
Merge branch 'main' into copilot/add-rustfs-support-nixos
houseme 59a52ec
Merge branch 'main' into copilot/add-rustfs-support-nixos
houseme aadad7a
chore: add copyright headers
houseme 5fab63a
Update CONTRIBUTING.md
houseme edc9577
Update CONTRIBUTING.md
houseme 61b9d21
Update examples/nixos-configuration.nix
houseme d7e50e2
Update examples/flake.nix
houseme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,18 @@ | ||
| # Nix build results | ||
| result | ||
| result-* | ||
|
|
||
| .direnv | ||
| # Nix development | ||
| .direnv | ||
| .envrc | ||
|
|
||
| # Editor files | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| <!--- | ||
| Copyright 2024 RustFS Team | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
|
|
||
| # Contributing to RustFS Flake | ||
|
|
||
| First off, thank you for considering contributing to RustFS! It's people like you that make RustFS such a great tool. | ||
|
|
||
| ## Development Workflow | ||
|
|
||
| This repository manages the Nix Flake for prebuilt RustFS binaries. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - [Nix](https://nixos.org/download.html) with Flakes enabled. | ||
| - [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) for code formatting. | ||
|
|
||
| ### Local Testing | ||
|
|
||
| Before submitting a PR, please ensure your changes are valid: | ||
|
|
||
| ```bash | ||
| # Format check | ||
| nix shell nixpkgs#nixpkgs-fmt -c nixpkgs-fmt --check . | ||
|
|
||
| # Syntax and basic flake check | ||
| nix flake check | ||
|
|
||
| # Build the default package for your system | ||
| nix build .#default | ||
|
|
||
| # Test the example configuration | ||
| cd examples && nix eval .#nixosConfigurations.example-host.config.services.rustfs | ||
| ``` | ||
|
|
||
| ### Updating Binaries | ||
|
|
||
| The `sources.json` file tracks the upstream versions and hashes. When a new version of RustFS is released: | ||
|
|
||
| 1. Update the `version` field in `sources.json`. | ||
| 2. Update the `sha256` hashes for all supported platforms. | ||
| 3. Verify the build: `nix build .`. | ||
|
|
||
| ## Coding Standards | ||
|
|
||
| - **Nix Style**: Follow the [Nixpkgs architecture](https://nixos.org/manual/nixpkgs/stable/) guidelines. | ||
| - **Modularity**: Keep the NixOS module (`nixos/rustfs.nix`) decoupled from the package definition. | ||
| - **Documentation**: Any new option in the NixOS module must include a clear `description`. | ||
|
|
||
| ## Pull Request Process | ||
|
|
||
| 1. Create a new branch: `git checkout -b feat/your-feature-name`. | ||
| 2. Commit your changes using [Conventional Commits](https://www.conventionalcommits.org/) (e.g., `feat: add tlsDirectory option`). | ||
| 3. Ensure the `examples/` are updated if you change the module interface. | ||
| 4. Submit the PR and wait for the maintainers' review. | ||
|
|
||
| ## Security | ||
|
|
||
| If you discover a security vulnerability, please do **not** open an issue. Instead, contact the maintainers directly using the contact options provided in this repository's hosting platform. | ||
|
|
||
| --- | ||
|
|
||
| *By contributing, you agree that your contributions will be licensed under the project's LICENSE.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Copyright 2024 RustFS Team | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| { | ||
| description = "Example NixOS system using RustFS Flake"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| rustfs-flake.url = "path:../."; | ||
| }; | ||
|
|
||
| outputs = { self, nixpkgs, rustfs-flake }: { | ||
| nixosConfigurations.example-host = nixpkgs.lib.nixosSystem { | ||
| system = "x86_64-linux"; | ||
| modules = [ | ||
| rustfs-flake.nixosModules.default | ||
|
|
||
| ({ config, pkgs, ... }: { | ||
| services.rustfs = { | ||
| enable = true; | ||
| package = rustfs-flake.packages.${pkgs.stdenv.hostPlatform.system}.default; | ||
|
|
||
| volumes = "/var/lib/rustfs/data"; | ||
| address = "0.0.0.0:9000"; | ||
| consoleEnable = true; | ||
| consoleAddress = "0.0.0.0:9001"; | ||
|
|
||
| accessKey = "admin-access-key"; | ||
| secretKey = "secure-secret-key"; | ||
|
|
||
| logLevel = "info"; | ||
| }; | ||
|
|
||
| networking.firewall.allowedTCPPorts = [ 9000 9001 ]; | ||
| system.stateVersion = "24.11"; | ||
| }) | ||
| ]; | ||
| }; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Copyright 2024 RustFS Team | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| { config, pkgs, ... }: | ||
|
|
||
| { | ||
| services.rustfs = { | ||
| enable = true; | ||
|
|
||
| # Storage path | ||
| volumes = "/var/lib/rustfs/data"; | ||
|
|
||
| # API server address (Port 9000) | ||
| address = "127.0.0.1:9000"; | ||
|
|
||
| # Management console configuration (Port 9001) | ||
| consoleEnable = true; | ||
| consoleAddress = "127.0.0.1:9001"; | ||
|
|
||
| # Logging configuration | ||
| logLevel = "info"; | ||
| logDirectory = "/var/log/rustfs"; | ||
|
|
||
| # Security: In production, do not hard-code secrets. Integrate a secret | ||
| # management tool such as sops-nix or agenix to provide these values. | ||
| # | ||
| # Example with sops-nix (assuming you have defined the secrets | ||
| # `rustfs-access-key` and `rustfs-secret-key` in your sops file): | ||
| # services.rustfs.accessKey = | ||
| # builtins.readFile config.sops.secrets."rustfs-access-key".path; | ||
| # services.rustfs.secretKey = | ||
| # builtins.readFile config.sops.secrets."rustfs-secret-key".path; | ||
| # | ||
| # For this example configuration, we use obvious placeholders instead of | ||
| # real secrets. Replace them with values injected by your secret manager. | ||
| accessKey = "<rustfs-access-key-from-secret-manager>"; | ||
| secretKey = "<rustfs-secret-key-from-secret-manager>"; | ||
| }; | ||
|
|
||
| # Open firewall ports for both API and Console | ||
| networking.firewall.allowedTCPPorts = [ | ||
| 9000 # RustFS API | ||
| 9001 # RustFS Console | ||
| ]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.