1load("@nix_config//:config.bzl", "SDK_UNIVERSAL_APPLE_DARWIN")
2load("@rules_rust//rust:toolchain.bzl", "rust_toolchain")
3
4rust_toolchain(
5    name = "rust_toolchain",
6    binary_ext = "",
7    cargo = "@nix_rust//:cargo",
8    clippy_driver = "@nix_rust//:clippy_driver",
9    default_edition = "2021",
10    dylib_ext = ".dylib",
11    env = {
12        "SDKROOT": SDK_UNIVERSAL_APPLE_DARWIN,
13    },
14    exec_triple = "x86_64-unknown-nixos-gnu",
15    extra_exec_rustc_flags = [
16        "-Clinker-flavor=ld64.lld",
17    ],
18    extra_rustc_flags = [
19        "-Clinker-flavor=ld64.lld",
20    ],
21    rust_doc = "@nix_rust//:rustdoc",
22    rust_std = "@nix_rust//:rust_std-aarch64-apple-darwin",
23    rustc = "@nix_rust//:rustc",
24    rustc_lib = "@nix_rust//:rustc_lib",
25    staticlib_ext = ".a",
26    stdlib_linkflags = [],
27    tags = ["manual"],
28    target_triple = "aarch64-apple-darwin",
29)
30
31toolchain(
32    name = "toolchain",
33    exec_compatible_with = [
34        "@platforms//cpu:x86_64",
35        "@platforms//os:nixos",
36    ],
37    target_compatible_with = [
38        "@platforms//cpu:aarch64",
39        "@platforms//os:macos",
40    ],
41    toolchain = ":rust_toolchain",
42    toolchain_type = "@rules_rust//rust:toolchain_type",
43)
44