@@ -0,0 +1,47 @@
1+{ lib, stdenv, rustPlatform, fetchFromBitbucket, llvmPackages, Libsystem, SystemConfiguration, installShellFiles }:
2+
3+rustPlatform.buildRustPackage rec {
4+ pname = "bore";
5+ version = "0.3.3";
6+
7+ src = fetchFromBitbucket {
8+ owner = "delan";
9+ repo = "nonymous";
10+ rev = version;
11+ sha256 = "0gws1f625izrb3armh6bay1k8l9p9csl37jx03yss1r720k4vn2x";
12+ };
13+
14+ cargoSha256 = "1n09gcp1y885lz6g2f73zw3fd0fmv7nwlvaqba2yl0kylzk7naa6";
15+ cargoBuildFlags = "-p ${pname}";
16+
17+ # FIXME can’t test --all-targets and --doc in a single invocation
18+ cargoTestFlags = "--features std --all-targets --workspace";
19+
20+ nativeBuildInputs = [ installShellFiles ]
21+ ++ lib.optional stdenv.isDarwin llvmPackages.libclang;
22+
23+ buildInputs = lib.optionals stdenv.isDarwin [
24+ Libsystem
25+ SystemConfiguration
26+ ];
27+
28+ LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib";
29+
30+ postInstall = ''
31+ installManPage $src/bore/doc/bore.1
32+ '';
33+
34+ doInstallCheck = true;
35+ installCheckPhase = ''
36+ printf '\0\0\0\0\0\0\0\0\0\0\0\0' \
37+ | $out/bin/bore --decode \
38+ | grep -q ';; NoError #0 Query 0 0 0 0 flags'
39+ '';
40+
41+ meta = with lib; {
42+ description = "DNS query tool";
43+ homepage = "https://crates.io/crates/bore";
44+ license = licenses.isc;
45+ maintainers = [ maintainers.delan ];
46+ };
47+}