-
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 toolchains 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. For instance, you can now run this command on a MacOS host to build a statically linked executable for x86_64-linux on a remote arm worker: ```bash bazel build \ nativelink \ --extra_execution_platforms=@local-remote-execution//lre-rs:aarch64-unknown-linux-gnu \ --platforms=@local-remote-execution//lre-rs:x86_64-unknown-linux-musl ```
- Loading branch information
1 parent
ae71bc8
commit fa0cde1
Showing
18 changed files
with
1,384 additions
and
43 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
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 | ||
# This environment is shared between toolchain autogen images and the final | ||
# toolchain image. | ||
Env = | ||
lre-cc.meta.Env | ||
++ [ | ||
# Add all tooling here so that the generated toolchains use `/nix/store/*` | ||
# paths instead of `/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;}; | ||
# Attached for passthrough to rbe-configs-gen. | ||
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.