1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 amaranth,
6 pdm-backend,
7 unstableGitUpdater,
8}:
9
10buildPythonPackage rec {
11 pname = "amaranth-soc";
12 version = "0.1a-unstable-2024-06-10";
13 pyproject = true;
14 # from `pdm show`
15 realVersion = let
16 tag = builtins.elemAt (lib.splitString "-" version) 0;
17 rev = lib.substring 0 7 src.rev;
18 in "${tag}1.dev1+g${rev}";
19
20 src = fetchFromGitHub {
21 owner = "amaranth-lang";
22 repo = "amaranth-soc";
23 rev = "e1b842800533f44924f21c3867bc2290084d100f";
24 hash = "sha256-GAGQEncONY566v8hLjGeZ7CRlOt36vHg+0a5xcB+g1Y=";
25 };
26
27 nativeBuildInputs = [ pdm-backend ];
28 dependencies = [ amaranth ];
29
30 preBuild = ''
31 export PDM_BUILD_SCM_VERSION="${realVersion}"
32 '';
33
34 passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; };
35
36 meta = with lib; {
37 description = "System on Chip toolkit for Amaranth HDL";
38 homepage = "https://github.com/amaranth-lang/amaranth-soc";
39 license = licenses.bsd2;
40 maintainers = with maintainers; [
41 thoughtpolice
42 pbsds
43 ];
44 };
45}