This commit is contained in:
Clément DOUIN
2024-11-26 09:08:13 +01:00
parent b4f337ea0d
commit 8f9e016936
2 changed files with 10 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ let
rustToolchain = mkToolchain.fromTarget {
inherit lib;
targetSystem = if isNull system then null else system.rustTarget;
target = if isNull system then null else system.rustTarget;
};
rustPlatform = pkgs.makeRustPlatform {

View File

@@ -17,14 +17,19 @@ rec {
armv7l-unknown-linux-musleabihf = "armv7-unknown-linux-musleabihf";
}.${target} or target;
fromTarget = { lib, targetSystem ? null }:
crossRustStd = name: target:
let
rustTarget = toRustTarget target;
crossToolchain = fenix.targets.${rustTarget}.fromToolchainName { inherit name sha256; };
in
crossToolchain.rust-std;
fromTarget = { lib, target ? null }:
let
name = (lib.importTOML file).toolchain.channel;
toolchain = fenix.fromToolchainName { inherit name sha256; };
target = if isNull targetSystem then null else toRustTarget targetSystem;
components = [ toolchain.rustc toolchain.cargo ]
++ lib.optional (!isNull target) (fenix.targets.${target}.fromToolchainName { inherit name sha256; }.rust-std);
++ lib.optional (!isNull target) (crossRustStd name target);
in
fenix.combine components;
}