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