{ pkgs , crane , buildTarget ? "x86_64-unknown-linux-musl" }: let craneLib = (crane.mkLib pkgs).overrideToolchain pkgs.rustToolchain; buildInputs = [ pkgs.protobuf ]; doCheck = false; src = pkgs.lib.cleanSourceWith { src = craneLib.path ../.; filter = path: type: (craneLib.filterCargoSources path type) || (builtins.match ".*proto$" path != null); }; in craneLib.buildPackage { inherit src doCheck buildInputs; CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static -C linker=rust-lld"; CARGO_BUILD_TARGET = buildTarget; }