77 inputs = {
88 nixpkgs . url = "github:NixOS/nixpkgs/nixos-unstable" ;
99 flake-utils . url = "github:numtide/flake-utils" ;
10+ fenix = {
11+ url = "github:nix-community/fenix" ;
12+ inputs . nixpkgs . follows = "nixpkgs" ;
13+ } ;
1014 } ;
1115
12- outputs = { self , nixpkgs , flake-utils , ... } :
16+ outputs = { self , nixpkgs , flake-utils , fenix , ... } :
1317 flake-utils . lib . eachDefaultSystem ( system :
1418 let
1519 system = "x86_64-linux" ;
1620 pkgs = nixpkgs . legacyPackages . ${ system } ;
21+
22+ # Create a Rust toolchain using fenix (Nightly)
23+ rustToolchain = ( fenix . packages . ${ system } . toolchainOf {
24+ channel = "nightly" ;
25+ date = "2025-10-15" ;
26+ sha256 = "sha256-nYxm7Okhb4WOD0C/qCJ3uzm+VwgQTG4SSpO8IXewVXU=" ;
27+ } ) . defaultToolchain ;
28+
29+ # Or for more granular control, use:
30+ # rustToolchain = fenix.packages.${system}.combine [
31+ # fenix.packages.${system}.latest.rustc
32+ # fenix.packages.${system}.latest.cargo
33+ # fenix.packages.${system}.latest.rustfmt
34+ # fenix.packages.${system}.latest.clippy
35+ # fenix.packages.${system}.latest.rust-src
36+ # fenix.packages.${system}.latest.rust-analyzer
37+ # ];
1738
1839 metacallConfig = {
1940 defaultLibPaths = [
2849 name = "metassr-dev" ;
2950
3051 buildInputs = with pkgs ; [
31- # Core Rust tools
32- rustc cargo rustfmt clippy rust-analyzer
33- # Build tools (REVIEW THIS)
52+ # Rust toolchain from fenix
53+ rustToolchain
54+ # Build tools
3455 pkg-config cmake gcc
3556 # System libs
3657 openssl libffi llvmPackages . libclang
3758 # Runtimes
3859 nodejs_22
3960 # dev tools
4061 git curl
41-
4262 less
4363 ] ;
4464
4767 "-I${ pkgs . libclang . lib } /lib/clang/${ pkgs . libclang . version } /include" ;
4868
4969 env = {
50- RUST_SRC_PATH =
51- "${ pkgs . rust . packages . stable . rustPlatform . rustLibSrc } " ;
70+ # rust-src is included in the fenix toolchain
71+ RUST_SRC_PATH = "${ rustToolchain } /lib/rustlib/src/rust/library " ;
5272 } ;
5373
5474 shellHook = ''
7090 '' ;
7191 } ;
7292 } ) ;
73- }
93+ }
0 commit comments