about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/sudachipy/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/sudachipy/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/sudachipy/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/sudachipy/default.nix b/nixpkgs/pkgs/development/python-modules/sudachipy/default.nix
new file mode 100644
index 000000000000..bfaf9be85846
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/sudachipy/default.nix
@@ -0,0 +1,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";
+  };
+}