Files
himalaya/rust-toolchain.nix
T
2024-11-27 10:04:12 +01:00

25 lines
614 B
Nix

{ lib, fenix }:
let
file = ./rust-toolchain.toml;
sha256 = "yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk=";
in
{
fromFile =
let spec = { inherit file sha256; };
in fenix.fromToolchainFile spec;
fromTarget = target:
let
name = (lib.importTOML file).toolchain.channel;
spec = { inherit name sha256; };
toolchain = fenix.fromToolchainName spec;
crossToolchain = fenix.targets.${target}.fromToolchainName spec;
components = [ toolchain.rustc toolchain.cargo ]
++ lib.optional (!isNull target) crossToolchain.rust-std;
in
fenix.combine components;
}