diff --git a/pkgs/by-name/cy/cynthion/package.nix b/pkgs/by-name/cy/cynthion/package.nix new file mode 100644 index 00000000000000..9ca3cef5a4af94 --- /dev/null +++ b/pkgs/by-name/cy/cynthion/package.nix @@ -0,0 +1,3 @@ +{ python3Packages }: + +python3Packages.toPythonApplication python3Packages.cynthion diff --git a/pkgs/development/python-modules/apollo-fpga/default.nix b/pkgs/development/python-modules/apollo-fpga/default.nix new file mode 100644 index 00000000000000..006e7fff06987d --- /dev/null +++ b/pkgs/development/python-modules/apollo-fpga/default.nix @@ -0,0 +1,54 @@ +{ + lib, + fetchPypi, + buildPythonPackage, + pythonOlder, + setuptools, + pyusb, + pyvcd, + prompt-toolkit, + pyxdg, + deprecation, +}: + +buildPythonPackage rec { + pname = "apollo-fpga"; + version = "1.1.0"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchPypi { + inherit version; + pname = "apollo_fpga"; + hash = "sha256-dLccmQ/2ZhQqL17JkpAhtuO5jZ3oUuIVcuYdQR0zwhQ="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ + pyusb + pyvcd + prompt-toolkit + pyxdg + deprecation + ]; + + pythonImportsCheck = [ + "apollo_fpga" + ]; + + meta = { + description = "microcontroller-based FPGA / JTAG programmer"; + homepage = "https://github.com/greatscottgadgets/apollo"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ carlossless ]; + }; +} diff --git a/pkgs/development/python-modules/cynthion/default.nix b/pkgs/development/python-modules/cynthion/default.nix new file mode 100644 index 00000000000000..ea6e803a57a390 --- /dev/null +++ b/pkgs/development/python-modules/cynthion/default.nix @@ -0,0 +1,89 @@ +{ + lib, + fetchPypi, + fetchFromGitHub, + buildPythonPackage, + amaranth, + pythonOlder, + setuptools, + future, + libusb1, + prompt-toolkit, + pyfwup, + pyserial, + pyusb, + tabulate, + tomli, + tqdm, + pygreat, + apollo-fpga, + luna-usb, + luna-soc, + pytestCheckHook, +}: + +let + amaranth_0_4 = amaranth.overridePythonAttrs rec { + version = "0.4.1"; + + src = fetchFromGitHub { + owner = "amaranth-lang"; + repo = "amaranth"; + rev = "v${version}"; + sha256 = "sha256-VMgycvxkphdpWIib7aZwh588En145RgYlG2Zfi6nnDo="; + }; + }; +in + +buildPythonPackage rec { + pname = "cynthion"; + version = "0.1.7"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-kBf3L4+2bBfdQ/6aoQcg0RG5Yt9dkS8MRCahmppBWko="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ + future + libusb1 + prompt-toolkit + pyfwup + pyserial + pyusb + tabulate + tomli + tqdm + pygreat + apollo-fpga + amaranth_0_4 + luna-usb + luna-soc + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ "cynthion" ]; + + meta = { + description = "Python package and utilities for the Great Scott Gadgets Cynthion USB Test Instrument"; + homepage = "https://github.com/greatscottgadgets/cynthion"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ carlossless ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +} diff --git a/pkgs/development/python-modules/luna-soc/default.nix b/pkgs/development/python-modules/luna-soc/default.nix new file mode 100644 index 00000000000000..c0b67d03117116 --- /dev/null +++ b/pkgs/development/python-modules/luna-soc/default.nix @@ -0,0 +1,44 @@ +{ + lib, + fetchPypi, + buildPythonPackage, + pythonOlder, + setuptools, + luna-usb, +}: + +buildPythonPackage rec { + pname = "luna-soc"; + version = "0.2.0"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchPypi { + inherit version; + pname = "luna_soc"; + hash = "sha256-Ohz/dkUuV/yoEphB7/YohuCp5GMQ//0NF1BPySg3IeU="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ luna-usb ]; + + pythonImportsCheck = [ + "luna_soc" + ]; + + meta = { + description = "Amaranth HDL libary for building USB-capable SoC designs."; + homepage = "https://github.com/greatscottgadgets/luna-soc"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ carlossless ]; + }; +} 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 00000000000000..b02e63d91be6d2 --- /dev/null +++ b/pkgs/development/python-modules/luna-usb/default.nix @@ -0,0 +1,87 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + pythonOlder, + + # build-system + setuptools, + + # dependencies + libusb1, + pyserial, + pyusb, + pyvcd, + amaranth, + usb-protocol, + + # tests + pytestCheckHook, + apollo-fpga +}: + +let + amaranth_0_4 = amaranth.overridePythonAttrs rec { + version = "0.4.1"; + + src = fetchFromGitHub { + owner = "amaranth-lang"; + repo = "amaranth"; + rev = "v${version}"; + sha256 = "sha256-VMgycvxkphdpWIib7aZwh588En145RgYlG2Zfi6nnDo="; + }; + }; +in + +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 = [ + libusb1 + pyserial + pyusb + pyvcd + amaranth_0_4 + usb-protocol + ]; + + nativeCheckInputs = [ + pytestCheckHook + apollo-fpga + ]; + + pytestFlagsArray = [ + "tests/" + ]; + + pythonImportsCheck = [ + "luna" + ]; + + meta = { + 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 ]; + }; +} diff --git a/pkgs/development/python-modules/pygreat/default.nix b/pkgs/development/python-modules/pygreat/default.nix index 6f66c9eb5dc7d2..ea656eea2b9cca 100644 --- a/pkgs/development/python-modules/pygreat/default.nix +++ b/pkgs/development/python-modules/pygreat/default.nix @@ -1,41 +1,52 @@ { lib, buildPythonPackage, - isPy3k, - fetchFromGitHub, + fetchPypi, + setuptools, + pythonOlder, + pythonRelaxDepsHook, future, pyusb, }: -buildPythonPackage { +buildPythonPackage rec { pname = "pygreat"; - version = "2019.5.1.dev0"; - format = "setuptools"; - - src = fetchFromGitHub { - owner = "greatscottgadgets"; - repo = "libgreat"; - rev = "14c00b7c8f036f4d467e4b1a324ffa3566b126fa"; - sha256 = "1h0z83k1k4z8j36z936h61l8j3cjr3wsxr86k91v5c5h93g9dkqh"; + version = "2024.0.2"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-VGZyvGLPyA6tOVh7boz4j/6o/iQ9mRvULOleFypGHGY="; }; - propagatedBuildInputs = [ + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + pythonRemoveDeps = [ + "backports.functools-lru-cache" + ]; + + dependencies = [ future pyusb ]; - disabled = !isPy3k; - - preBuild = '' - cd host - substituteInPlace setup.py --replace "'backports.functools_lru_cache'" "" - substituteInPlace pygreat/comms.py --replace "from backports.functools_lru_cache import lru_cache as memoize_with_lru_cache" "from functools import lru_cache as memoize_with_lru_cache" - echo "$version" > ../VERSION - ''; + pythonImportsCheck = [ + "pygreat" + ]; - meta = with lib; { + meta = { description = "Python library for talking with libGreat devices"; homepage = "https://greatscottgadgets.com/greatfet/"; - license = with licenses; [ bsd3 ]; + license = with lib.licenses; [ bsd3 ]; + maintainers = with lib.maintainers; [ carlossless ]; }; } diff --git a/pkgs/development/python-modules/usb-protocol/default.nix b/pkgs/development/python-modules/usb-protocol/default.nix new file mode 100644 index 00000000000000..10dda92f321899 --- /dev/null +++ b/pkgs/development/python-modules/usb-protocol/default.nix @@ -0,0 +1,49 @@ +{ + lib, + fetchPypi, + buildPythonPackage, + pythonOlder, + setuptools, + construct, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "usb-protocol"; + version = "0.9.1"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchPypi { + inherit version; + pname = "usb_protocol"; + hash = "sha256-5v9M+WJ5v7XQEH3ZxuTz3gN2LQ9hNvQsSwJH4H3S/iQ="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ construct ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "usb_protocol" + ]; + + meta = { + description = "Python library providing utilities, data structures, constants, parsers, and tools for working with the USB protocol."; + homepage = "https://github.com/greatscottgadgets/python-usb-protocol"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ carlossless ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 732514205908a8..544e16a9026ee8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -696,6 +696,8 @@ self: super: with self; { aplpy = callPackage ../development/python-modules/aplpy { }; + apollo-fpga = callPackage ../development/python-modules/apollo-fpga { }; + app-model = callPackage ../development/python-modules/app-model { }; appdirs = callPackage ../development/python-modules/appdirs { }; @@ -2808,6 +2810,8 @@ self: super: with self; { cymruwhois = callPackage ../development/python-modules/cymruwhois { }; + cynthion = callPackage ../development/python-modules/cynthion { }; + cypari2 = callPackage ../development/python-modules/cypari2 { }; cypherpunkpay = callPackage ../development/python-modules/cypherpunkpay { }; @@ -7531,6 +7535,10 @@ self: super: with self; { lunarcalendar = callPackage ../development/python-modules/lunarcalendar { }; + luna-soc = callPackage ../development/python-modules/luna-soc { }; + + luna-usb = callPackage ../development/python-modules/luna-usb { }; + luqum = callPackage ../development/python-modules/luqum { }; luxor = callPackage ../development/python-modules/luxor { }; @@ -17170,6 +17178,8 @@ self: super: with self; { usb-monitor = callPackage ../development/python-modules/usb-monitor { }; + usb-protocol = callPackage ../development/python-modules/usb-protocol { }; + usbrelay-py = callPackage ../os-specific/linux/usbrelay/python.nix { }; usbtmc = callPackage ../development/python-modules/usbtmc { };