From 321efae699032b4ce7d7a710b163a6114c3633fe Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 30 Aug 2019 21:44:30 +0100 Subject: [PATCH] python3Packages.nmigen{,-boards}: init at unstable-2019-08-{31,30} --- .../python-modules/nmigen-boards/default.nix | 32 +++++++++ .../python-modules/nmigen/default.nix | 65 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 4 ++ 3 files changed, 101 insertions(+) create mode 100644 pkgs/development/python-modules/nmigen-boards/default.nix create mode 100644 pkgs/development/python-modules/nmigen/default.nix diff --git a/pkgs/development/python-modules/nmigen-boards/default.nix b/pkgs/development/python-modules/nmigen-boards/default.nix new file mode 100644 index 000000000000..4151d08b60f4 --- /dev/null +++ b/pkgs/development/python-modules/nmigen-boards/default.nix @@ -0,0 +1,32 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, nmigen +}: + +buildPythonPackage rec { + pname = "nmigen-boards"; + version = "unstable-2019-08-30"; + realVersion = lib.substring 0 7 src.rev; + + src = fetchFromGitHub { + owner = "m-labs"; + repo = "nmigen-boards"; + rev = "3b80b3a3749ae8f123ff258a25e81bd21412aed4"; + sha256 = "01qynxip8bq23jfjc5wjd97vxfvhld2zb8sxphwf0zixrmmyaspi"; + }; + + propagatedBuildInputs = [ nmigen ]; + + postPatch = '' + substituteInPlace setup.py \ + --replace 'versioneer.get_version()' '"${realVersion}"' + ''; + + meta = with lib; { + description = "Board and connector definitions for nMigen"; + homepage = https://github.com/m-labs/nmigen-boards; + license = licenses.bsd0; + maintainers = with maintainers; [ emily ]; + }; +} diff --git a/pkgs/development/python-modules/nmigen/default.nix b/pkgs/development/python-modules/nmigen/default.nix new file mode 100644 index 000000000000..7375eda43271 --- /dev/null +++ b/pkgs/development/python-modules/nmigen/default.nix @@ -0,0 +1,65 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromGitHub +, pyvcd +, bitarray +, jinja2 + +# nmigen.{test,build} call out to these +, yosys +, symbiyosys +, nextpnr ? null +, icestorm ? null +, trellis ? null + +# for tests +, yices +}: + +buildPythonPackage rec { + pname = "nmigen"; + version = "unstable-2019-08-31"; + realVersion = lib.substring 0 7 src.rev; + + src = fetchFromGitHub { + owner = "m-labs"; + repo = "nmigen"; + rev = "2e206220462c67aa6ae97f7515a2191440fd61b3"; + sha256 = "0y3w6vd493jqm9b8ppgwzs02v1al8w1n5gylljlsw70ci7fyk4qa"; + }; + + disabled = pythonOlder "3.6"; + + propagatedBuildInputs = [ pyvcd bitarray jinja2 ]; + + checkInputs = [ yosys yices ]; + + postPatch = let + tool = pkg: name: + if pkg == null then {} else { "${name}" = "${pkg}/bin/${name}"; }; + + # Only FOSS toolchain supported out of the box, sorry! + toolchainOverrides = + tool yosys "yosys" // + tool symbiyosys "sby" // + tool nextpnr "nextpnr-ice40" // + tool nextpnr "nextpnr-ecp5" // + tool icestorm "icepack" // + tool trellis "ecppack"; + in '' + substituteInPlace setup.py \ + --replace 'versioneer.get_version()' '"${realVersion}"' + + substituteInPlace nmigen/_toolchain.py \ + --replace 'overrides = {}' \ + 'overrides = ${builtins.toJSON toolchainOverrides}' + ''; + + meta = with lib; { + description = "A refreshed Python toolbox for building complex digital hardware"; + homepage = https://github.com/m-labs/nmigen; + license = licenses.bsd0; + maintainers = with maintainers; [ emily ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7482ec7a9b2f..390d8e2d3d02 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2578,6 +2578,10 @@ in { Nikola = callPackage ../development/python-modules/Nikola { }; + nmigen = callPackage ../development/python-modules/nmigen { }; + + nmigen-boards = callPackage ../development/python-modules/nmigen-boards { }; + nxt-python = callPackage ../development/python-modules/nxt-python { }; odfpy = callPackage ../development/python-modules/odfpy { };