nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 libftdi1,
6 libusb1,
7 poetry-core,
8}:
9
10buildPythonPackage rec {
11 pname = "pylibftdi";
12 version = "0.23.0";
13 pyproject = true;
14
15 src = fetchPypi {
16 inherit pname version;
17 hash = "sha256-v1tMa6c9eab234ScNFsAunY9AjIBvtm6Udh2pDl7Ftg=";
18 };
19
20 build-system = [ poetry-core ];
21
22 dependencies = [
23 libftdi1
24 libusb1
25 ];
26
27 postPatch = ''
28 substituteInPlace src/pylibftdi/driver.py \
29 --replace-fail 'self._load_library("libusb")' 'cdll.LoadLibrary("${libusb1.out}/lib/libusb-1.0.so")' \
30 --replace-fail 'self._load_library("libftdi")' 'cdll.LoadLibrary("${libftdi1.out}/lib/libftdi1.so")'
31 '';
32
33 pythonImportsCheck = [ "pylibftdi" ];
34
35 meta = {
36 description = "Wrapper to Intra2net's libftdi driver for FTDI's USB devices";
37 homepage = "https://pylibftdi.readthedocs.io/";
38 changelog = "https://github.com/codedstructure/pylibftdi/blob/${version}/CHANGES.txt";
39 license = lib.licenses.mit;
40 maintainers = with lib.maintainers; [ matthuszagh ];
41 };
42}