This commit is contained in:
zastian@mrthoddata.com
2025-05-08 18:18:39 +01:00
commit 7ba4004c22
24 changed files with 5042 additions and 0 deletions

59
flake.nix Normal file
View File

@@ -0,0 +1,59 @@
{
description = "A Rust project with development environment and build support";
inputs = {
#nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, rust-overlay, ... }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
});
in
{
# Define the package (your Rust binary)
packages = forEachSupportedSystem ({ pkgs }: {
default = pkgs.rustPlatform.buildRustPackage {
name = "bitBeam";
src = ./.;
# Specify dependencies (replace with your project's actual dependencies)
buildInputs = [ pkgs.openssl pkgs.pkg-config ];
# Generate this with `cargo generate-lockfile` if you don't have it
cargoLock = {
lockFile = ./Cargo.lock;
};
# Optional: Override the Rust version if needed
nativeBuildInputs = [ pkgs.rust-bin.stable.latest.default ];
};
});
# Development environment (existing setup)
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
rust-bin.stable.latest.default
openssl
pkg-config
cargo-deny
cargo-edit
cargo-watch
rust-analyzer
];
RUST_SRC_PATH = "${pkgs.rust-bin.stable.latest.default}/lib/rustlib/src/rust/library";
};
});
};
}