about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/nmigen/default.nix
blob: d42e27a29329ed131c624031ec75639eaeb82cf7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, setuptools
, setuptools-scm
, pyvcd
, jinja2
, importlib-resources
, importlib-metadata
, git

# for tests
, pytestCheckHook
, yosys
, symbiyosys
, yices
}:

buildPythonPackage rec {
  pname = "nmigen";
  version = "unstable-2021-02-09";
  # python setup.py --version
  realVersion = "0.3.dev243+g${lib.substring 0 7 src.rev}";
  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "nmigen";
    repo = "nmigen";
    rev = "f7c2b9419f9de450be76a0e9cf681931295df65f";
    sha256 = "0cjs9wgmxa76xqmjhsw4fsb2mhgvd85jgs2mrjxqp6fwp8rlgnl1";
  };

  nativeBuildInputs = [ setuptools-scm git ];

  propagatedBuildInputs = [
    setuptools
    pyvcd
    jinja2
  ] ++
    lib.optional (pythonOlder "3.9") importlib-resources ++
    lib.optional (pythonOlder "3.8") importlib-metadata;

  checkInputs = [ pytestCheckHook yosys symbiyosys yices ];

  preBuild = ''
    export SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}"
  '';

  meta = with lib; {
    description = "A refreshed Python toolbox for building complex digital hardware";
    homepage = "https://nmigen.info/nmigen";
    license = licenses.bsd2;
    maintainers = with maintainers; [ emily ];
  };
}