aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-10-10 13:56:33 +0200
committerAlex Auvolat <alex@adnab.me>2023-10-10 13:56:48 +0200
commitd3fffd30dcf66a9da2e466ae6274547b090313e2 (patch)
tree5d6a025d99823dc9810e0b2876c1566fdf970343
parente75fe2157d0973eb4320bbc87be5e54a1cb91a63 (diff)
downloadgarage-mold-linker.tar.gz
garage-mold-linker.zip
use mold linker when invoking cargo manually (not in nix build scripts)mold-linker
-rw-r--r--.cargo/config.toml3
-rw-r--r--flake.nix5
-rw-r--r--shell.nix21
3 files changed, 18 insertions, 11 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 00000000..d29d6c33
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,3 @@
+[target.x86_64-unknown-linux-gnu]
+linker = "clang"
+rustflags = ["-C", "link-arg=-fuse-ld=mold"]
diff --git a/flake.nix b/flake.nix
index 32c01616..f8d7d4df 100644
--- a/flake.nix
+++ b/flake.nix
@@ -48,6 +48,9 @@
pkgsSrc = nixpkgs;
cargo2nixOverlay = cargo2nix.overlays.default;
release = false;
- }).workspaceShell { packages = [ pkgs.rustfmt ]; };
+ }).workspaceShell { packages = with pkgs; [
+ rustfmt
+ mold
+ ]; };
});
}
diff --git a/shell.nix b/shell.nix
index 0d510e33..88e292a8 100644
--- a/shell.nix
+++ b/shell.nix
@@ -15,16 +15,17 @@ in {
# --- Rust Shell ---
# Use it to compile Garage
rust = pkgs.mkShell {
- nativeBuildInputs = [
- #pkgs.rustPlatform.rust.rustc
- pkgs.rustPlatform.rust.cargo
- #pkgs.clippy
- pkgs.rustfmt
- #pkgs.perl
- #pkgs.protobuf
- #pkgs.pkg-config
- #pkgs.openssl
- pkgs.file
+ nativeBuildInputs = with pkgs; [
+ #rustPlatform.rust.rustc
+ rustPlatform.rust.cargo
+ mold
+ #clippy
+ rustfmt
+ #perl
+ #protobuf
+ #pkg-config
+ #openssl
+ file
#cargo2nix.packages.x86_64-linux.cargo2nix
];
};