1
0
forked from quiK/hellorust

add flake, envrc

This commit is contained in:
2025-08-10 11:22:05 +02:00
parent 61a6086fea
commit 9a23cf2bb1
4 changed files with 62 additions and 58 deletions

View File

@@ -1,36 +1,37 @@
{
description = "Rust Development Shell";
description = "Pinned Rust dev shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
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:
outputs = { self, nixpkgs, rust-overlay, ... }:
let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
inherit system;
overlays = [ (import rust-overlay) ];
};
in
with pkgs;
{
devShells.default = mkShell {
buildInputs = [
openssl
pkg-config
(
rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
})
)
];
rustToolchain = pkgs.rust-bin.stable."1.89.0".default.override {
extensions = [ "rust-src" "rust-analyzer" ];
};
}
in f pkgs rustToolchain
);
in {
devShells = forAllSystems (pkgs: rustToolchain: {
default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.pkg-config
rustToolchain
pkgs.lldb
];
buildInputs = [
pkgs.openssl
];
};
});
};
}