diff --git a/pkgs/development/python-modules/fx2/default.nix b/pkgs/development/python-modules/fx2/default.nix new file mode 100644 index 000000000000..fa5edc1077c6 --- /dev/null +++ b/pkgs/development/python-modules/fx2/default.nix @@ -0,0 +1,45 @@ +{ lib +, buildPythonPackage +, python +, fetchFromGitHub +, sdcc +, libusb1 +, crcmod +}: + +buildPythonPackage { + pname = "fx2"; + version = "unstable-2019-08-27"; + + src = fetchFromGitHub { + owner = "whitequark"; + repo = "libfx2"; + rev = "dd1e42c7b46ff410dbb18beab46111bb5491400c"; + sha256 = "0xvlmx6ym0ylrvnlqzf18d475wa0mfci7wkdbv30gl3hgdhsppjz"; + }; + + nativeBuildInputs = [ sdcc ]; + + propagatedBuildInputs = [ libusb1 crcmod ]; + + preBuild = '' + cd software + ${python.pythonForBuild.interpreter} setup.py build_ext + ''; + + preInstall = '' + mkdir -p $out/share/libfx2 + cp -R ../firmware/library/{.stamp,lib,include,fx2{rules,conf}.mk} \ + $out/share/libfx2 + ''; + + # installCheckPhase tries to run build_ext again and there are no tests + doCheck = false; + + meta = with lib; { + description = "Chip support package for Cypress EZ-USB FX2 series microcontrollers"; + homepage = https://github.com/whitequark/libfx2; + license = licenses.bsd0; + maintainers = with maintainers; [ emily ]; + }; +} diff --git a/pkgs/development/python-modules/glasgow/default.nix b/pkgs/development/python-modules/glasgow/default.nix new file mode 100644 index 000000000000..264a13aed5e7 --- /dev/null +++ b/pkgs/development/python-modules/glasgow/default.nix @@ -0,0 +1,66 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, sdcc +, nmigen +, fx2 +, libusb1 +, aiohttp +, pyvcd +, bitarray +, crcmod +, yosys +, icestorm +, nextpnr +}: + +buildPythonPackage rec { + pname = "glasgow"; + version = "unstable-2019-08-31"; + realVersion = lib.substring 0 7 src.rev; + + src = fetchFromGitHub { + owner = "GlasgowEmbedded"; + repo = "Glasgow"; + rev = "21641a13c6a0daaf8618aff3c5bfffcb26ef6cca"; + sha256 = "1dpm1jmm4fg8xf17s6h9g5sc09gq8b6xq955sv2x11nrbqf98l4v"; + }; + + nativeBuildInputs = [ sdcc ]; + + propagatedBuildInputs = [ + nmigen + fx2 + libusb1 + aiohttp + pyvcd + bitarray + crcmod + ]; + + postPatch = '' + substituteInPlace software/setup.py \ + --replace 'versioneer.get_version()' '"${realVersion}"' + ''; + + preBuild = '' + make -C firmware LIBFX2=${fx2}/share/libfx2 + cp firmware/glasgow.ihex software/glasgow + cd software + ''; + + # a couple failing tests and also installCheck tries to build_ext again + doInstallCheck = false; + doCheck = false; + + checkPhase = '' + python -m unittest discover + ''; + + meta = with lib; { + description = "Software for Glasgow, a digital interface multitool"; + homepage = https://github.com/GlasgowEmbedded/Glasgow; + license = licenses.bsd0; + maintainers = with maintainers; [ emily ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c35fa4aae256..6638473874f6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -818,6 +818,8 @@ in ezstream = callPackage ../tools/audio/ezstream { }; + libfx2 = with python3Packages; toPythonApplication fx2; + fxlinuxprintutil = callPackage ../tools/misc/fxlinuxprintutil { }; genymotion = callPackage ../development/mobile/genymotion { }; @@ -842,6 +844,8 @@ in gitter = callPackage ../applications/networking/instant-messengers/gitter { }; + glasgow = with python3Packages; toPythonApplication glasgow; + gucci = callPackage ../tools/text/gucci { }; grc = callPackage ../tools/misc/grc { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 390d8e2d3d02..00b606ef734c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2338,6 +2338,8 @@ in { future-fstrings = callPackage ../development/python-modules/future-fstrings { }; + fx2 = callPackage ../development/python-modules/fx2 { }; + gateone = callPackage ../development/python-modules/gateone { }; # TODO: Remove after 19.03 is branched off: @@ -2348,6 +2350,8 @@ in { GeoIP = callPackage ../development/python-modules/GeoIP { }; + glasgow = callPackage ../development/python-modules/glasgow { }; + gmpy = callPackage ../development/python-modules/gmpy { }; gmpy2 = callPackage ../development/python-modules/gmpy2 { };