1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 # build-system
8 cmake,
9 nanobind,
10 ninja,
11 scikit-build-core,
12 setuptools,
13 setuptools-scm,
14 typing-extensions,
15
16 # native dependencies
17 libsoxr,
18
19 # dependencies
20 numpy,
21
22 # tests
23 pytestCheckHook,
24}:
25
26buildPythonPackage rec {
27 pname = "soxr";
28 version = "1.0.0";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "dofuuz";
33 repo = "python-soxr";
34 tag = "v${version}";
35 hash = "sha256-8NVQD1LamIRe77bKEs8YqHXeXifdMJpQUedmeiBRHSI=";
36 };
37
38 patches = [ ./cmake-nanobind.patch ];
39
40 nativeBuildInputs = [
41 cmake
42 ninja
43 ];
44
45 dontUseCmakeConfigure = true;
46
47 cmakeFlags = [
48 (lib.cmakeBool "USE_SYSTEM_LIBSOXR" true)
49 ];
50
51 build-system = [
52 scikit-build-core
53 nanobind
54 setuptools
55 setuptools-scm
56 ]
57 ++ lib.optionals (pythonOlder "3.11") [
58 typing-extensions
59 ];
60
61 buildInputs = [ libsoxr ];
62
63 dependencies = [ numpy ];
64
65 pythonImportsCheck = [ "soxr" ];
66
67 nativeCheckInputs = [ pytestCheckHook ];
68
69 meta = with lib; {
70 changelog = "https://github.com/dofuuz/python-soxr/releases/tag/${src.tag}";
71 description = "High quality, one-dimensional sample-rate conversion library";
72 homepage = "https://github.com/dofuuz/python-soxr/tree/main";
73 license = licenses.lgpl21Plus;
74 maintainers = with maintainers; [ hexa ];
75 };
76}