Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, rustPlatform 6, cargo 7, darwin 8, rustc 9, setuptools-rust 10, json-stream-rs-tokenizer 11, json-stream 12}: 13 14buildPythonPackage rec { 15 pname = "json-stream-rs-tokenizer"; 16 version = "0.4.16"; 17 format = "setuptools"; 18 19 src = fetchFromGitHub { 20 owner = "smheidrich"; 21 repo = "py-json-stream-rs-tokenizer"; 22 rev = "refs/tags/v${version}"; 23 hash = "sha256-MnYkCAI8x65kU0EoTRf4ZVsbjNravjokepX4yViu7go="; 24 }; 25 26 postPatch = '' 27 cp ${./Cargo.lock} ./Cargo.lock 28 ''; 29 30 cargoDeps = rustPlatform.fetchCargoTarball { 31 inherit src postPatch; 32 name = "${pname}-${version}"; 33 hash = "sha256-HwWH8/UWKWOdRmyCVQtNqJxXD55f6zxLY0LhR7JU9ro="; 34 }; 35 36 nativeBuildInputs = [ 37 setuptools-rust 38 rustPlatform.cargoSetupHook 39 cargo 40 rustc 41 ]; 42 43 buildInputs = lib.optionals stdenv.isDarwin [ 44 darwin.libiconv 45 ]; 46 47 # Tests depend on json-stream, which depends on this package. 48 # To avoid infinite recursion, we only enable tests when building passthru.tests. 49 doCheck = false; 50 51 checkInputs = [ 52 json-stream 53 ]; 54 55 pythonImportsCheck = [ 56 "json_stream_rs_tokenizer" 57 ]; 58 59 passthru.tests = { 60 runTests = json-stream-rs-tokenizer.overrideAttrs (_: { doCheck = true; }); 61 }; 62 63 meta = with lib; { 64 description = "A faster tokenizer for the json-stream Python library"; 65 homepage = "https://github.com/smheidrich/py-json-stream-rs-tokenizer"; 66 license = licenses.mit; 67 maintainers = with maintainers; [ winter ]; 68 }; 69}