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

View file

@ -1,4 +1,4 @@
{ pkgs, lib, self, modulesPath, ... }:
{ pkgs, lib, self, modulesPath, rustOverlay, ... }:
{
imports = [
@ -66,8 +66,12 @@
];
nixpkgs.overlays = [
rustOverlay
(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
rustPlatform = pkgs.makeRustPlatform {
cargo = rust193;
rustc = rust193;
};
src = ../..;
cargoLock = {
@ -17,7 +22,7 @@ let
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;
cargoBuildFlags = [ "--package" pname ] ++ cargoFlags;
cargoTestFlags = [ "--package" pname ];