Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@

rust-toolchain = fenix.packages.${system}.fromManifestFile rust-manifest;

rustflags =
if pkgs.stdenv.hostPlatform.rust.rustcTargetSpec == "x86_64-unknown-linux-gnu" then
# Upstream defaults to lld on x86_64-unknown-linux-gnu, we need to use the system linker
"-Clinker-features=-lld -Clink-self-contained=-linker"
else
null;

# Crane-based Nix flake configuration.
# Based on https://github.com/ipetkov/crane/blob/master/examples/trunk-workspace/flake.nix
craneLib = (crane.mkLib pkgs).overrideToolchain rust-toolchain.defaultToolchain;
Expand Down Expand Up @@ -92,12 +99,7 @@
];

env = {
RUSTFLAGS =
if pkgs.stdenv.hostPlatform.rust.rustcTargetSpec == "x86_64-unknown-linux-gnu" then
# Upstream defaults to lld on x86_64-unknown-linux-gnu, we need to use the system linker
"-Clinker-features=-lld -Clink-self-contained=-linker"
else
null;
RUSTFLAGS = rustflags;
};
};

Expand Down Expand Up @@ -172,6 +174,7 @@
];

RUST_SRC_PATH = "${rust-toolchain.rust-src}/lib/rustlib/src/rust/library";
RUSTFLAGS = rustflags;

packages = [
# A script for quickly running tests.
Expand Down