himalaya/rust-toolchain.nix

25 lines
688 B
Nix
Raw Normal View History

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