1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 amaranth,
11 libusb1,
12 pyserial,
13 pyusb,
14 pyvcd,
15 usb-protocol,
16
17 # tests
18 pytestCheckHook,
19 apollo-fpga,
20}:
21buildPythonPackage rec {
22 pname = "luna-usb";
23 version = "0.2.3";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "greatscottgadgets";
28 repo = "luna";
29 tag = version;
30 hash = "sha256-kH5PlgJRMymBZZ3oANR8xlAUPUgGZjqw9s9DcpQ809A=";
31 };
32
33 postPatch = ''
34 substituteInPlace pyproject.toml \
35 --replace-fail '"setuptools-git-versioning<2"' "" \
36 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
37 '';
38
39 build-system = [
40 setuptools
41 ];
42
43 dependencies = [
44 amaranth
45 libusb1
46 pyserial
47 pyusb
48 pyvcd
49 usb-protocol
50 ];
51
52 nativeCheckInputs = [
53 pytestCheckHook
54 apollo-fpga
55 ];
56
57 enabledTestPaths = [
58 "tests/"
59 ];
60
61 pythonImportsCheck = [
62 "luna"
63 ];
64
65 meta = {
66 changelog = "https://github.com/greatscottgadgets/luna/releases/tag/${src.tag}";
67 description = "Amaranth HDL framework for monitoring, hacking, and developing USB devices";
68 homepage = "https://github.com/greatscottgadgets/luna";
69 license = lib.licenses.bsd3;
70 maintainers = with lib.maintainers; [ carlossless ];
71 };
72}