diff --git a/pkgs/by-name/cy/cynthion/package.nix b/pkgs/by-name/cy/cynthion/package.nix new file mode 100644 index 000000000000..70c767cf8ef7 --- /dev/null +++ b/pkgs/by-name/cy/cynthion/package.nix @@ -0,0 +1,26 @@ +{ + python3, + fetchFromGitHub, +}: + +let + python = python3.override { + self = python3; + packageOverrides = _: super: { + amaranth = super.amaranth.overridePythonAttrs rec { + version = "0.4.1"; + + src = fetchFromGitHub { + owner = "amaranth-lang"; + repo = "amaranth"; + rev = "refs/tags/v${version}"; + sha256 = "sha256-VMgycvxkphdpWIib7aZwh588En145RgYlG2Zfi6nnDo="; + }; + + postPatch = null; + }; + }; + }; +in + +python.pkgs.toPythonApplication python.pkgs.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 000000000000..44a0a5a144d0 --- /dev/null +++ b/pkgs/development/python-modules/apollo-fpga/default.nix @@ -0,0 +1,63 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + pythonOlder, + + # build-system + setuptools, + + # dependencies + deprecation, + prompt-toolkit, + pyusb, + pyvcd, + pyxdg, +}: + +buildPythonPackage rec { + pname = "apollo-fpga"; + version = "1.1.0"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "greatscottgadgets"; + repo = "apollo"; + rev = "refs/tags/v${version}"; + hash = "sha256-9BoHGdqjnWkP83zXdjzyoAhYB6n7SJ/zlr8pvqb+9kg="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ + deprecation + prompt-toolkit + pyusb + pyvcd + pyxdg + ]; + + # has no tests + doCheck = false; + + pythonImportsCheck = [ + "apollo_fpga" + ]; + + meta = { + changelog = "https://github.com/greatscottgadgets/apollo/releases/tag/v${version}"; + 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 000000000000..a3a4d9dde001 --- /dev/null +++ b/pkgs/development/python-modules/cynthion/default.nix @@ -0,0 +1,85 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + pythonOlder, + + # build-system + setuptools, + + # dependencies + amaranth, + apollo-fpga, + future, + libusb1, + luna-soc, + luna-usb, + prompt-toolkit, + pyfwup, + pygreat, + pyserial, + pyusb, + tabulate, + tomli, + tqdm, + + # tests + pytestCheckHook, +}: +buildPythonPackage rec { + pname = "cynthion"; + version = "0.1.7"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "greatscottgadgets"; + repo = "cynthion"; + rev = "refs/tags/${version}"; + hash = "sha256-2nVfODAg4t5hoSKUEP4IN23R+JGe3lw/rpfjW/UIsYw="; + }; + + sourceRoot = "${src.name}/cynthion/python"; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ + amaranth + apollo-fpga + future + libusb1 + luna-soc + luna-usb + prompt-toolkit + pyfwup + pygreat + pyserial + pyusb + tabulate + tomli + tqdm + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ "cynthion" ]; + + meta = { + changelog = "https://github.com/greatscottgadgets/cynthion/releases/tag/${version}"; + 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 ]; + broken = lib.versionAtLeast amaranth.version "0.5"; + }; +} 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 000000000000..277dabe0e89e --- /dev/null +++ b/pkgs/development/python-modules/luna-soc/default.nix @@ -0,0 +1,53 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + pythonOlder, + + # build-system + setuptools, + + # dependencies + luna-usb, +}: + +buildPythonPackage rec { + pname = "luna-soc"; + version = "0.2.0"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "greatscottgadgets"; + repo = "luna-soc"; + rev = "refs/tags/${version}"; + hash = "sha256-P8P32hM1cVXENcDpCrmPe8BvkMCWdeEgHwbIU94uLe8="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools-git-versioning<2"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ luna-usb ]; + + # has no tests + doCheck = false; + + pythonImportsCheck = [ + "luna_soc" + ]; + + meta = { + changelog = "https://github.com/greatscottgadgets/luna-soc/releases/tag/${version}"; + description = "Amaranth HDL library 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 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/development/python-modules/usb-protocol/default.nix b/pkgs/development/python-modules/usb-protocol/default.nix new file mode 100644 index 000000000000..fa21782fc1cc --- /dev/null +++ b/pkgs/development/python-modules/usb-protocol/default.nix @@ -0,0 +1,57 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + pythonOlder, + + # build-system + setuptools, + + # dependencies + construct, + + # tests + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "usb-protocol"; + version = "0.9.1"; + pyproject = true; + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "greatscottgadgets"; + repo = "python-usb-protocol"; + rev = "refs/tags/${version}"; + hash = "sha256-CYbXs/SRC1FAVEzfw0gwf6U0qQ9Q34nyuj5yfjHfDn8="; + }; + + 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 = { + changelog = "https://github.com/greatscottgadgets/python-usb-protocol/releases/tag/${version}"; + 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 62f9ae46754d..fbcba684ca9e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -698,6 +698,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 { }; @@ -2828,6 +2830,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 { }; @@ -7620,6 +7624,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 { }; @@ -17344,6 +17352,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 { };