Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 darwin,
6 rustPlatform,
7 pkg-config,
8 openssl,
9 runCommand,
10 patchelf,
11 zlib,
12}:
13
14rustPlatform.buildRustPackage rec {
15 pname = "cargo-bisect-rustc";
16 version = "0.6.8";
17
18 src = fetchFromGitHub {
19 owner = "rust-lang";
20 repo = pname;
21 rev = "v${version}";
22 hash = "sha256-7HiM1oRuLSfRaum66duag/w8ncFdxRLF0yeSGlIey0Y=";
23 };
24
25 patches =
26 let
27 patchelfPatch =
28 runCommand "0001-dynamically-patchelf-binaries.patch"
29 {
30 CC = stdenv.cc;
31 patchelf = patchelf;
32 libPath = "$ORIGIN/../lib:${lib.makeLibraryPath [ zlib ]}";
33 }
34 ''
35 export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
36 substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
37 --subst-var patchelf \
38 --subst-var dynamicLinker \
39 --subst-var libPath
40 '';
41 in
42 lib.optionals stdenv.isLinux [ patchelfPatch ];
43
44 nativeBuildInputs = [ pkg-config ];
45
46 buildInputs =
47 [ openssl ]
48 ++ lib.optionals stdenv.isDarwin [
49 darwin.apple_sdk.frameworks.Security
50 darwin.apple_sdk.frameworks.SystemConfiguration
51 ];
52
53 cargoHash = "sha256-CgEs0cejquFRY3VN6CgbE23Gipg+LEuWp/jSIkITrjw=";
54
55 checkFlags = [
56 "--skip test_github" # requires internet
57 ];
58
59 meta = with lib; {
60 description = "Bisects rustc, either nightlies or CI artifacts";
61 mainProgram = "cargo-bisect-rustc";
62 homepage = "https://github.com/rust-lang/cargo-bisect-rustc";
63 license = with licenses; [
64 asl20
65 mit
66 ];
67 maintainers = with maintainers; [ davidtwco ];
68 };
69}