diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..4822d9da --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1765270179, + "narHash": "sha256-g2a4MhRKu4ymR4xwo+I+auTknXt/+j37Lnf0Mvfl1rE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "677fbe97984e7af3175b6c121f3c39ee5c8d62c9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..675c1f57 --- /dev/null +++ b/flake.nix @@ -0,0 +1,66 @@ +# Nix flake for building RustFS +# +# Prerequisites: +# Install Nix: https://nixos.org/download/ +# Enable flakes: https://nixos.wiki/wiki/Flakes#Enable_flakes +# +# Usage: +# nix build # Build rustfs binary +# nix run # Build and run rustfs +# ./result/bin/rustfs --help +{ + description = "RustFS - High-performance S3-compatible object storage"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + outputs = + { nixpkgs, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + in + { + packages = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = pkgs.rustPlatform.buildRustPackage { + pname = "rustfs"; + version = "0.0.5"; + + src = ./.; + + cargoLock.lockFile = ./Cargo.lock; + + nativeBuildInputs = with pkgs; [ + pkg-config + protobuf + ]; + + buildInputs = with pkgs; [ openssl ]; + + cargoBuildFlags = [ + "--package" + "rustfs" + ]; + + doCheck = false; + + meta = { + description = "High-performance S3-compatible object storage"; + homepage = "https://rustfs.com"; + license = pkgs.lib.licenses.asl20; + mainProgram = "rustfs"; + }; + }; + } + ); + }; +}