Skip to content

Commit

Permalink
nix: Allow for more precision in sysroot config
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed Apr 22, 2024
1 parent a20aab1 commit f34cfa6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions hacking/nix/rust-utils/build-sysroot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ in
, extraManifest ? {}
, extraConfig ? {}
, rustTargetInfo ? defaultRustTargetInfo
, compilerBuiltinsWeakIntrinsics ? false
, alloc ? true
, compilerBuiltinsMem ? true
}:

let
Expand Down Expand Up @@ -70,10 +71,15 @@ let
extraConfig
]);

features = lib.concatStringsSep "," ([
crates = lib.concatStringsSep "," ([
"core"
"compiler_builtins"
] ++ lib.optionals alloc [
"alloc"
]);

features = lib.concatStringsSep "," (lib.optionals compilerBuiltinsMem [
"compiler-builtins-mem"
] ++ lib.optionals compilerBuiltinsWeakIntrinsics [
"compiler-builtins-weak-intrinsics"
]);

in
Expand All @@ -90,7 +96,7 @@ runCommand "sysroot" {
--config ${config} \
${lib.optionalString (profile != null) "--profile ${profile}"} \
--target ${rustTargetInfo.name} \
-Z build-std=core,alloc,compiler_builtins \
-Z build-std=${crates} \
-Z build-std-features=${features} \
--manifest-path ${workspace}/Cargo.toml \
--target-dir $(pwd)/target
Expand Down
1 change: 1 addition & 0 deletions hacking/nix/scope/world/sel4-kernel-loader.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ let
sysroot = buildSysroot {
inherit profile rustTargetInfo;
extraManifest = profiles;
alloc = false;
};

in
Expand Down

0 comments on commit f34cfa6

Please sign in to comment.