about summary refs log tree commit diff
path: root/pkgs/development/python-modules/amaranth-soc/default.nix
blob: aee85e709aff13109e7449a9d4d3b57aa8f7821f (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  amaranth,
  pdm-backend,
  unstableGitUpdater,
}:

buildPythonPackage rec {
  pname = "amaranth-soc";
  version = "0.1a-unstable-2024-05-17";
  pyproject = true;
  # from `pdm show`
  realVersion = let
     tag = builtins.elemAt (lib.splitString "-" version) 0;
     rev = lib.substring 0 7 src.rev;
    in "${tag}1.dev1+g${rev}";

  src = fetchFromGitHub {
    owner = "amaranth-lang";
    repo = "amaranth-soc";
    rev = "45ff663b83694b09b2b8f3fc0f10c555a12ba987";
    hash = "sha256-Ql8XYC13wscPL96HY0kXselq78D747BpLK8X1sxpwz0=";
  };

  nativeBuildInputs = [ pdm-backend ];
  dependencies = [ amaranth ];

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

  passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; };

  meta = with lib; {
    description = "System on Chip toolkit for Amaranth HDL";
    homepage = "https://github.com/amaranth-lang/amaranth-soc";
    license = licenses.bsd2;
    maintainers = with maintainers; [
      thoughtpolice
      pbsds
    ];
  };
}