Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 cargo, 6 libiconv, 7 rustPlatform, 8 rustc, 9 sudachi-rs, 10 setuptools-rust, 11 pytestCheckHook, 12 sudachidict-core, 13 tokenizers, 14 sudachipy, 15}: 16 17buildPythonPackage rec { 18 pname = "sudachipy"; 19 inherit (sudachi-rs) src version; 20 21 cargoDeps = rustPlatform.fetchCargoTarball { 22 inherit src; 23 name = "${pname}-${version}"; 24 hash = "sha256-ARwvThfATDdzBTjPFr9yjbE/0eYvp/TCZOEGbUupJmU="; 25 }; 26 27 nativeBuildInputs = [ 28 cargo 29 rustPlatform.cargoSetupHook 30 rustc 31 setuptools-rust 32 ]; 33 34 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]; 35 36 preBuild = '' 37 cd python 38 ''; 39 40 # avoid infinite recursion due to sudachidict 41 doCheck = false; 42 43 nativeCheckInputs = [ 44 pytestCheckHook 45 sudachidict-core 46 tokenizers 47 ]; 48 49 pythonImportsCheck = [ "sudachipy" ]; 50 51 passthru = { 52 inherit (sudachi-rs) updateScript; 53 tests = { 54 pytest = sudachipy.overridePythonAttrs (_: { 55 doCheck = true; 56 # avoid catchConflicts of sudachipy 57 # we don't need to install this package since it is just a test 58 dontInstall = true; 59 }); 60 }; 61 }; 62 63 meta = sudachi-rs.meta // { 64 homepage = "https://github.com/WorksApplications/sudachi.rs/tree/develop/python"; 65 mainProgram = "sudachipy"; 66 }; 67}