From a9cc00721e86a466009963dd619002c64d436a83 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Tue, 24 Oct 2023 11:54:15 +0100 Subject: [PATCH] build: use lld linker globally Previously it was only set for the nix shell, let's set this for images too by using the cargo config build settings. Signed-off-by: Tiago Castro --- .cargo/config | 4 ++++ nix/pkgs/control-plane/cargo-project.nix | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .cargo/config diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 000000000..b0fc91874 --- /dev/null +++ b/.cargo/config @@ -0,0 +1,4 @@ +[env] +# Use lld linker to work around issue when building all tests where all ram is gobbled up! +# This helps reduce memory usage, though not completely. +NIX_CFLAGS_LINK = " -fuse-ld=lld" \ No newline at end of file diff --git a/nix/pkgs/control-plane/cargo-project.nix b/nix/pkgs/control-plane/cargo-project.nix index 2bf065e94..1914e1d67 100644 --- a/nix/pkgs/control-plane/cargo-project.nix +++ b/nix/pkgs/control-plane/cargo-project.nix @@ -12,7 +12,7 @@ , gitVersions , openapi-generator , which -, udev +, systemdMinimal , utillinux # with allInOne set to true all components are built as part of the same "cargo build" derivation # this allows for a quicker build of all components but slower single components @@ -56,6 +56,7 @@ let src_list = [ "Cargo.lock" "Cargo.toml" + ".cargo" "common" "control-plane" "deployer" @@ -77,8 +78,8 @@ let GIT_VERSION = "${gitVersions.tag_or_long}"; inherit LIBCLANG_PATH PROTOC PROTOC_INCLUDE; - nativeBuildInputs = [ clang pkg-config openapi-generator which git ]; - buildInputs = [ llvmPackages.libclang protobuf openssl udev utillinux ]; + nativeBuildInputs = [ clang pkg-config openapi-generator which git llvmPackages.bintools ]; + buildInputs = [ llvmPackages.libclang protobuf openssl.dev systemdMinimal.dev utillinux.dev ]; doCheck = false; }; release_build = { "release" = true; "debug" = false; };