Skip to content

Commit

Permalink
build: use lld linker globally
Browse files Browse the repository at this point in the history
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 <tiagolobocastro@gmail.com>
  • Loading branch information
tiagolobocastro committed Nov 8, 2023
1 parent a6902de commit a9cc007
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 4 additions & 3 deletions nix/pkgs/control-plane/cargo-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -56,6 +56,7 @@ let
src_list = [
"Cargo.lock"
"Cargo.toml"
".cargo"
"common"
"control-plane"
"deployer"
Expand All @@ -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; };
Expand Down

0 comments on commit a9cc007

Please sign in to comment.