build(nix): use Rust 1.93.0 via rust-overlay for all package builds

Add oxalica/rust-overlay flake input; override rustPlatform in
weft-packages.nix with cargo/rustc from rust-bin.stable.1.93.0;
apply overlay in both devShell and nixosConfigurations.weft-vm.
Fixes build failure where nixos-25.05 Rust 1.86.0 was below the
rust-version requirement of wasmtime and other dependencies.
This commit is contained in:
Marco Allegretti 2026-03-12 21:28:14 +01:00
parent f6cefeeccc
commit 294bd163b9
3 changed files with 31 additions and 9 deletions

View file

@ -4,16 +4,26 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { self, nixpkgs, flake-utils }: outputs = { self, nixpkgs, flake-utils, rust-overlay }:
let let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
in in
flake-utils.lib.eachSystem supportedSystems (system: flake-utils.lib.eachSystem supportedSystems (system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = import nixpkgs {
weftPkgs = pkgs.callPackage ./infra/nixos/weft-packages.nix { }; inherit system;
overlays = [ rust-overlay.overlays.default ];
};
rust193 = pkgs.rust-bin.stable."1.93.0".default;
weftPkgs = pkgs.callPackage ./infra/nixos/weft-packages.nix {
inherit rust193;
};
in in
{ {
packages = weftPkgs // { packages = weftPkgs // {
@ -23,7 +33,7 @@
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
name = "weft-dev"; name = "weft-dev";
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
rustup rust193
pkg-config pkg-config
cmake cmake
clang clang
@ -52,7 +62,10 @@
) // { ) // {
nixosConfigurations.weft-vm = nixpkgs.lib.nixosSystem { nixosConfigurations.weft-vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit self; }; specialArgs = {
inherit self;
rustOverlay = rust-overlay.overlays.default;
};
modules = [ modules = [
./infra/nixos/configuration.nix ./infra/nixos/configuration.nix
]; ];

View file

@ -1,4 +1,4 @@
{ pkgs, lib, self, modulesPath, ... }: { pkgs, lib, self, modulesPath, rustOverlay, ... }:
{ {
imports = [ imports = [
@ -66,8 +66,12 @@
]; ];
nixpkgs.overlays = [ nixpkgs.overlays = [
rustOverlay
(final: prev: { (final: prev: {
weft = final.callPackage ./weft-packages.nix { }; rust193 = final.rust-bin.stable."1.93.0".default;
weft = final.callPackage ./weft-packages.nix {
rust193 = final.rust193;
};
}) })
]; ];

View file

@ -1,6 +1,11 @@
{ pkgs, ... }: { pkgs, rust193, ... }:
let let
rustPlatform = pkgs.makeRustPlatform {
cargo = rust193;
rustc = rust193;
};
src = ../..; src = ../..;
cargoLock = { cargoLock = {
@ -17,7 +22,7 @@ let
nativeBuildInputs = with pkgs; [ pkg-config ]; nativeBuildInputs = with pkgs; [ pkg-config ];
}; };
mkWeftPkg = { pname, extraBuildInputs ? [], extraNativeBuildInputs ? [], cargoFlags ? [], extraEnv ? {} }: pkgs.rustPlatform.buildRustPackage (commonArgs // { mkWeftPkg = { pname, extraBuildInputs ? [], extraNativeBuildInputs ? [], cargoFlags ? [], extraEnv ? {} }: rustPlatform.buildRustPackage (commonArgs // {
inherit pname; inherit pname;
cargoBuildFlags = [ "--package" pname ] ++ cargoFlags; cargoBuildFlags = [ "--package" pname ] ++ cargoFlags;
cargoTestFlags = [ "--package" pname ]; cargoTestFlags = [ "--package" pname ];