day 01 - 2026
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
{
|
||||
description = "A reproducible Rust development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ (import rust-overlay) ];
|
||||
};
|
||||
|
||||
# Choose your preferred Rust toolchain (e.g., stable, nightly, or specific version)
|
||||
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
||||
extensions = [ "rust-src" "rust-analyzer" ];
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
# Tools available in the shell environment. rustToolchain includes rust-analyzer,
|
||||
# so any Neovim config (e.g. rustaceanvim) picks it up automatically via PATH.
|
||||
packages = [
|
||||
rustToolchain
|
||||
pkgs.cargo-watch # Optional but highly useful utility
|
||||
];
|
||||
|
||||
# System libraries and build dependencies frequently needed by Rust crates
|
||||
buildInputs = with pkgs; [
|
||||
openssl
|
||||
pkg-config
|
||||
];
|
||||
|
||||
# Environment variables required by Rust tooling
|
||||
env = {
|
||||
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
|
||||
RUST_BACKTRACE = "1";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user