From 98495ef959d50acef96fe67d5ca29faae45c04db Mon Sep 17 00:00:00 2001 From: Nick Spinale Date: Sun, 21 Apr 2024 21:17:09 +0000 Subject: [PATCH] nix: Allow for more precision in sysroot config Signed-off-by: Nick Spinale --- hacking/nix/rust-utils/build-sysroot.nix | 16 +++++++++++----- hacking/nix/scope/world/sel4-kernel-loader.nix | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hacking/nix/rust-utils/build-sysroot.nix b/hacking/nix/rust-utils/build-sysroot.nix index 1dc7d96f3..c815329c9 100644 --- a/hacking/nix/rust-utils/build-sysroot.nix +++ b/hacking/nix/rust-utils/build-sysroot.nix @@ -25,7 +25,8 @@ in , extraManifest ? {} , extraConfig ? {} , rustTargetInfo ? defaultRustTargetInfo -, compilerBuiltinsWeakIntrinsics ? false +, alloc ? true +, compilerBuiltinsMem ? true }: let @@ -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 @@ -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 diff --git a/hacking/nix/scope/world/sel4-kernel-loader.nix b/hacking/nix/scope/world/sel4-kernel-loader.nix index 34a4d2ee2..b7ee1ed0a 100644 --- a/hacking/nix/scope/world/sel4-kernel-loader.nix +++ b/hacking/nix/scope/world/sel4-kernel-loader.nix @@ -41,6 +41,7 @@ let sysroot = buildSysroot { inherit profile rustTargetInfo; extraManifest = profiles; + alloc = false; }; in