1{ rustPlatform, fetchFromGitHub, lib, stdenv }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "rustc-demangle";
5 version = "0.1.20";
6
7 src = fetchFromGitHub {
8 owner = "alexcrichton";
9 repo = pname;
10 rev = version;
11 sha256 = "sha256-elxclyuLmr3N66s+pR4/6OU98k1oXI2wKVJtzWPY8FI=";
12 };
13
14 cargoLock = {
15 # generated using `cargo generate-lockfile` since repo is missing lockfile
16 lockFile = ./Cargo.lock;
17 };
18
19 cargoBuildFlags = [ "-p" "rustc-demangle-capi" ];
20
21 postPatch = ''
22 ln -s ${./Cargo.lock} Cargo.lock
23 '';
24
25 postInstall = ''
26 mkdir -p $out/lib
27 cp target/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/librustc_demangle.so $out/lib
28 cp -R crates/capi/include $out
29 '';
30
31 meta = with lib; {
32 description = "Rust symbol demangling";
33 homepage = "https://github.com/alexcrichton/rustc-demangle";
34 license = with licenses; [ asl20 mit ];
35 # upstream supports other platforms, but maintainer can only test on linux
36 platforms = platforms.linux;
37 maintainers = with maintainers; [ _1000teslas ];
38 };
39}