2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildPythonPackage,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
cython,
|
|
|
|
git,
|
|
|
|
pkgconfig,
|
|
|
|
setuptools,
|
|
|
|
setuptools-scm,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# dependneices
|
|
|
|
numpy,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# optional-dependenices
|
|
|
|
pyusb,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
mock,
|
|
|
|
pytestCheckHook,
|
|
|
|
zipp,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
# In NixOS, add the package to services.udev.packages for non-root plugdev
|
|
|
|
# users to get device access permission:
|
|
|
|
# services.udev.packages = [ pkgs.python3Packages.seabreeze ];
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "seabreeze";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.6.0";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ap--";
|
|
|
|
repo = "python-seabreeze";
|
2024-01-13 08:15:51 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-Ead9G4i8/mFwPqL2PGsndtmX93Njld3nvTTr6ROJTac=";
|
2021-05-20 23:08:51 +00:00
|
|
|
leaveDotGit = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
nativeBuildInputs = [
|
2024-04-21 15:54:59 +00:00
|
|
|
cython
|
2021-05-20 23:08:51 +00:00
|
|
|
git
|
|
|
|
pkgconfig
|
2024-01-13 08:15:51 +00:00
|
|
|
setuptools
|
2021-05-20 23:08:51 +00:00
|
|
|
setuptools-scm
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ numpy ];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
passthru.optional-dependencies = {
|
2024-06-05 15:53:02 +00:00
|
|
|
pyseabreeze = [ pyusb ];
|
2024-01-13 08:15:51 +00:00
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/etc/udev/rules.d
|
2021-05-20 23:08:51 +00:00
|
|
|
cp os_support/10-oceanoptics.rules $out/etc/udev/rules.d/10-oceanoptics.rules
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
# few backends enabled, but still some tests
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-05-20 23:08:51 +00:00
|
|
|
pytestCheckHook
|
|
|
|
mock
|
|
|
|
zipp
|
2024-01-13 08:15:51 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
setupPyBuildFlags = [ "--without-cseabreeze" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/ap--/python-seabreeze";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Python library to access Ocean Optics spectrometers";
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|