Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
19f5ac2
Initial plan
Copilot Jan 4, 2026
d5be4d1
Add flake.nix with NixOS module and overlay
Copilot Jan 4, 2026
b92bb2d
Add examples and contributing guidelines
Copilot Jan 4, 2026
6ef242f
Fix security issues: add proper shell escaping and fix StateDirectory
Copilot Jan 4, 2026
71c2aba
Remove placeholder flake.lock, will be auto-generated by Nix
Copilot Jan 4, 2026
41630bb
Add automatic data directory creation and user home configuration
Copilot Jan 4, 2026
8e5fcb6
Add read-only access to config file when specified
Copilot Jan 4, 2026
b53697f
Fix dev shell hook and make example consistent with defaults
Copilot Jan 4, 2026
a443601
Apply suggestions from code review
houseme Jan 4, 2026
55021e9
Update examples/nixos-configuration.nix
houseme Jan 4, 2026
7763d4c
Fix systemd ExecStart, add StateDirectory, and improve config file ac…
Copilot Jan 4, 2026
e4746ea
Fix user/group creation logic to handle mismatched user and group
Copilot Jan 4, 2026
c084dee
Fix lib.escapeShellArg and simplify group creation logic
Copilot Jan 4, 2026
5621e68
Improve group creation logic to handle all user/group combinations
Copilot Jan 4, 2026
4244a0f
Merge branch 'main' into copilot/add-rustfs-support-nixos
houseme Jan 15, 2026
ba42f2c
feat: optimize NixOS module and enhance examples with console support
houseme Jan 15, 2026
7c3327e
Merge branch 'main' into copilot/add-rustfs-support-nixos
houseme Jan 15, 2026
59a52ec
Merge branch 'main' into copilot/add-rustfs-support-nixos
houseme Jan 15, 2026
aadad7a
chore: add copyright headers
houseme Jan 15, 2026
5fab63a
Update CONTRIBUTING.md
houseme Jan 15, 2026
edc9577
Update CONTRIBUTING.md
houseme Jan 15, 2026
61b9d21
Update examples/nixos-configuration.nix
houseme Jan 15, 2026
d7e50e2
Update examples/flake.nix
houseme Jan 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .gitignore
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
75 changes: 75 additions & 0 deletions CONTRIBUTING.md
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.*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ The TLS directory.

Additional environment variables to set for the RustFS service.
These will be appended to the environment file at /etc/default/rustfs.
Used for advanced configuration not covered by other options. (e.g. `RUST_BACKTRACE`)
Used for advanced configuration not covered by other options. (e.g. `RUST_BACKTRACE`)
51 changes: 51 additions & 0 deletions examples/flake.nix
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";
})
];
};
};
}
56 changes: 56 additions & 0 deletions examples/nixos-configuration.nix
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
];
}
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
# Standard NixOS Module
nixosModules.rustfs = import ./nixos/rustfs.nix;
nixosModules.default = self.nixosModules.rustfs;

# Overlays for extending nixpkgs
overlays.default = final: prev: {
rustfs = self.packages.${prev.system}.default;
};
Expand Down