about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/sudachipy/default.nix
blob: bfaf9be85846b4a1bcc2b0d7c76567cdbda19e6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ lib
, stdenv
, buildPythonPackage
, cargo
, libiconv
, rustPlatform
, rustc
, sudachi-rs
, setuptools-rust
, pytestCheckHook
, sudachidict-core
, tokenizers
}:

buildPythonPackage rec {
  pname = "sudachipy";
  inherit (sudachi-rs) src version;

  cargoDeps = rustPlatform.fetchCargoTarball {
    inherit src;
    name = "${pname}-${version}";
    hash = "sha256-Am+ae2lgnndSDzf0GF8R1i6OPLdIlm2dLThqYqXbscA=";
  };

  nativeBuildInputs = [
    cargo
    rustPlatform.cargoSetupHook
    rustc
    setuptools-rust
  ];

  buildInputs = lib.optionals stdenv.isDarwin [
    libiconv
  ];

  preBuild = ''
    cd python
  '';

  nativeCheckInputs = [
    pytestCheckHook
    sudachidict-core
    tokenizers
  ];

  pythonImportsCheck = [
    "sudachipy"
  ];

  meta = sudachi-rs.meta // {
    homepage = "https://github.com/WorksApplications/sudachi.rs/tree/develop/python";
    mainProgram = "sudachipy";
  };
}