himalaya/rust-toolchain.nix

28 lines
683 B
Nix
Raw Normal View History

fenix:
let
file = ./rust-toolchain.toml;
2023-06-03 22:06:11 +00:00
sha256 = "gdYqng0y9iHYzYPAdkC/ka3DRny3La/S5G8ASj0Ayyc=";
in
{
fromFile = { system }: fenix.packages.${system}.fromToolchainFile {
inherit file sha256;
};
fromTarget = { pkgs, buildPlatform, targetPlatform ? null }:
let
inherit ((pkgs.lib.importTOML file).toolchain) channel;
toolchain = fenix.packages.${buildPlatform};
in
if
isNull targetPlatform
then
fenix.packages.${buildPlatform}.${channel}.toolchain
else
toolchain.combine [
toolchain.${channel}.rustc
toolchain.${channel}.cargo
toolchain.targets.${targetPlatform}.${channel}.rust-std
];
}