Use buildRustPackage instead of buildRustCrate (via crate2nix). buildRustPackage builds the whole executable and its libraries in a single `cargo build` process. With the create2nix approach each library is built in a separate derivation, directly using rustc instead of the cargo wrapper. Benefits of buildRustPackage: - Much simpler to maintain - Package derivation evaluates much faster Benefits of crate2nix: - Build can be distributed over multiple build hosts - Better sharing of common dependencies between different builds - More fine-grained rebuilding on build failures In nixpkgs buildRustPackage is used for almost all Rust pkgs, it's also a better fit for our use case.
26 lines
708 B
Nix
26 lines
708 B
Nix
{ lib, rustPlatform, clang, llvmPackages, fetchFromGitHub }:
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "electrs";
|
|
version = "0.8.3";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "romanz";
|
|
repo = "electrs";
|
|
rev = "v${version}";
|
|
sha256 = "01993iv3kkf56s5x33gvk433zjwvqlfxa5vqrjl4ghr4i303ysc2";
|
|
};
|
|
|
|
# Needed for librocksdb-sys
|
|
buildInputs = [ clang ];
|
|
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
|
|
|
cargoSha256 = "19qs8if8fmygv6j74s6iwzm534fybwasjvmzdqcl996xhg75w6gi";
|
|
|
|
meta = with lib; {
|
|
description = "An efficient Electrum Server in Rust";
|
|
homepage = "https://github.com/romanz/electrs";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ earvstedt ];
|
|
};
|
|
}
|