diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-12-09 18:55:19 +0000 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-12-09 18:55:19 +0000 |
commit | 80d90d9b204f7c17912740f9f414fe5d59f293ba (patch) | |
tree | 5f2065a06e724270610760d59d01c6888b375a46 /infra/libkookie/nixpkgs/pkgs/development/compilers/rust/default.nix | |
parent | 3a31a84c7d3e589035ad08499206aac44a81f424 (diff) | |
parent | 83cbad92d73216bb0d9187c56cce0b91f9121d5a (diff) |
Merge commit '83cbad92d73216bb0d9187c56cce0b91f9121d5a' into main
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/compilers/rust/default.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/compilers/rust/default.nix | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/compilers/rust/default.nix b/infra/libkookie/nixpkgs/pkgs/development/compilers/rust/default.nix index 74c076c204b4..25876cc63803 100644 --- a/infra/libkookie/nixpkgs/pkgs/development/compilers/rust/default.nix +++ b/infra/libkookie/nixpkgs/pkgs/development/compilers/rust/default.nix @@ -24,9 +24,10 @@ if platform.isDarwin then "macos" else platform.parsed.kernel.name; - # Target triple. Rust has slightly different naming conventions than we use. + # Returns the name of the rust target, even if it is custom. Adjustments are + # because rust has slightly different naming conventions than we do. toRustTarget = platform: with platform.parsed; let - cpu_ = platform.rustc.arch or { + cpu_ = platform.rustc.platform.arch or { "armv7a" = "armv7"; "armv7l" = "armv7"; "armv6l" = "arm"; @@ -34,6 +35,13 @@ in platform.rustc.config or "${cpu_}-${vendor.name}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}"; + # Returns the name of the rust target if it is standard, or the json file + # containing the custom target spec. + toRustTargetSpec = platform: + if (platform.rustc or {}) ? platform + then builtins.toFile (toRustTarget platform + ".json") (builtins.toJSON platform.rustc.platform) + else toRustTarget platform; + # This just contains tools for now. But it would conceivably contain # libraries too, say if we picked some default/recommended versions from # `cratesIO` to build by Hydra and/or try to prefer/bias in Cargo.lock for |