-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Local Remote Execution for Rust
This change implements ~40 Rust toolchain configurations that reuse Nix's executables and make them available via Bazel. The new setup is fully reproducible, supports musl and glibc and works from all nix-supported hosts to all sensible crosscompilation targets seamlessly through remote and local execution. Until we have the actual infrastructure set up to fully test all configurations we have these 12 which are practically usable immediately: - MacOS native, aarch64 and x86_64, stable and nightly - Linux native, aarch64 and x64_64, stable and nightly, glibc and musl The channel is configurable via a new `--@local-remote-execution//lre-rs:channel` flag while the libc version is configurable via the target platform. For instance: ```bash bazel build \ nativelink \ --@local-remote-execution//lre-rs:channel=nightly \ --platforms=@local-remote-execution//lre-rs/platforms:x86_64-unknown-linux-gnu bazel build \ nativelink \ --platforms=@local-remote-execution//lre-rs/platforms:x86_64-unknown-linux-musl bazel build nativelink ```
- Loading branch information
1 parent
ae71bc8
commit e686526
Showing
26 changed files
with
1,573 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
constraint_setting(name = "libc") | ||
|
||
constraint_value( | ||
name = "glibc", | ||
constraint_setting = ":libc", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
constraint_value( | ||
name = "musl", | ||
constraint_setting = ":libc", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
lib, | ||
buildImage, | ||
lre-cc, | ||
rust-toolchains, | ||
}: let | ||
Env = | ||
# Rust requires a functional C++ toolchain. | ||
lre-cc.meta.Env | ||
++ [ | ||
# This causes the rust toolchains to be available under `/nix/store/*` | ||
# paths but not under "generic" paths like `/bin` or `/usr/bin`. | ||
# This way we're guaranteed to use binary identical toolchains during | ||
# local and remote execution. | ||
"RUST=${lib.concatStringsSep ":" rust-toolchains}" | ||
]; | ||
in | ||
buildImage { | ||
name = "lre-rs"; | ||
maxLayers = 100; | ||
config = {inherit Env;}; | ||
# Passthrough so that other images can reuse the environment. | ||
meta = {inherit Env;}; | ||
|
||
# Don't set a tag here so that the image is tagged by its derivation hash. | ||
# tag = null; | ||
} |
Oops, something went wrong.