1{ lib
2, fetchFromGitHub
3, buildPythonPackage
4, verilog
5, ghdl
6, pytest
7, pytest-xdist
8}:
9
10buildPythonPackage rec {
11 pname = "myhdl";
12 # The stable version is from 2019 and it doesn't pass tests
13 version = "unstable-2022-04-26";
14 # The pypi src doesn't contain the ci script used in checkPhase
15 src = fetchFromGitHub {
16 owner = "myhdl";
17 repo = "myhdl";
18 rev = "1a4f5cd4e9de2e7bbf1053c3c2bc9526b5cc524a";
19 hash = "sha256-Tgoem88Y6AhlCKVhMm0Khg6GPcrEktYOqV8xcMaNkl4=";
20 };
21
22 nativeCheckInputs = [
23 pytest
24 pytest-xdist
25 verilog
26 ghdl
27 ];
28 passthru = {
29 # If using myhdl as a dependency, use these if needed and not ghdl and
30 # verlog from all-packages.nix
31 inherit ghdl verilog;
32 };
33 checkPhase = ''
34 runHook preCheck
35
36 for target in {core,iverilog,ghdl}; do
37 env CI_TARGET="$target" bash ./scripts/ci.sh
38 done;
39
40 runHook postCheck
41 '';
42
43 meta = with lib; {
44 description = "A free, open-source package for using Python as a hardware description and verification language.";
45 homepage = "https://www.myhdl.org/";
46 license = licenses.lgpl21;
47 maintainers = with maintainers; [ doronbehar ];
48 };
49}