himalaya/rust-toolchain.nix

25 lines
686 B
Nix
Raw Normal View History

fenix:
let
file = ./rust-toolchain.toml;
2024-04-16 19:26:00 +00:00
sha256 = "+syqAd2kX8KVa8/U2gz3blIQTTsYYt3U63xBWaGOSc8=";
in
{
fromFile = { system }: fenix.packages.${system}.fromToolchainFile {
inherit file sha256;
};
2024-04-16 19:26:00 +00:00
fromTarget = { pkgs, buildPlatform, targetPlatform }:
let
2024-04-16 19:26:00 +00:00
name = (pkgs.lib.importTOML file).toolchain.channel;
fenixPackage = fenix.packages.${buildPlatform};
toolchain = fenixPackage.fromToolchainName { inherit name sha256; };
targetToolchain = fenixPackage.targets.${targetPlatform}.fromToolchainName { inherit name sha256; };
in
2024-04-16 19:26:00 +00:00
fenixPackage.combine [
toolchain.rustc
toolchain.cargo
targetToolchain.rust-std
];
}