nix: build with llvm.stdenv; use mold linker

This commit is contained in:
raf 2024-08-05 02:04:23 +03:00
parent 5c335d179e
commit 7de3f27642
Signed by: NotAShelf
GPG key ID: AF26552424E53993

View file

@ -1,17 +1,21 @@
{
lib,
rustPlatform,
stdenvAdapters,
llvm,
}: let
toml = (lib.importTOML ../Cargo.toml).package;
pname = toml.name;
inherit (toml) version;
in
rustPlatform.buildRustPackage {
rustPlatform.buildRustPackage.override {stdenv = stdenvAdapters.useMoldLinker llvm.stdenv;} {
RUSTFLAGS = "-C link-arg=-fuse-ld=mold";
inherit pname version;
src = builtins.path {
name = "${pname}-${version}";
path = ../.;
path = lib.sources.cleanSource ../.;
};
cargoLock.lockFile = ../Cargo.lock;