diff --git a/pkgs/development/python-modules/luna-usb/default.nix b/pkgs/development/python-modules/luna-usb/default.nix new file mode 100644 index 000000000000..e5a7b44cd275 --- /dev/null +++ b/pkgs/development/python-modules/luna-usb/default.nix @@ -0,0 +1,75 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + pythonOlder, + + # build-system + setuptools, + + # dependencies + amaranth, + libusb1, + pyserial, + pyusb, + pyvcd, + usb-protocol, + + # tests + pytestCheckHook, + apollo-fpga, +}: +buildPythonPackage rec { + pname = "luna-usb"; + version = "0.1.2"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "greatscottgadgets"; + repo = "luna"; + rev = "refs/tags/${version}"; + hash = "sha256-T9V0rI6vcEpM3kN/duRni6v2plCU4B379Zx07dBGKjk="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ + amaranth + libusb1 + pyserial + pyusb + pyvcd + usb-protocol + ]; + + nativeCheckInputs = [ + pytestCheckHook + apollo-fpga + ]; + + pytestFlagsArray = [ + "tests/" + ]; + + pythonImportsCheck = [ + "luna" + ]; + + meta = { + changelog = "https://github.com/greatscottgadgets/luna/releases/tag/${version}"; + description = "Amaranth HDL framework for monitoring, hacking, and developing USB devices"; + homepage = "https://github.com/greatscottgadgets/luna"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ carlossless ]; + broken = lib.versionAtLeast amaranth.version "0.5"; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 3bfa283153cb..6213343f5258 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7610,6 +7610,8 @@ self: super: with self; { lunarcalendar = callPackage ../development/python-modules/lunarcalendar { }; + luna-usb = callPackage ../development/python-modules/luna-usb { }; + luqum = callPackage ../development/python-modules/luqum { }; luxor = callPackage ../development/python-modules/luxor { };