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-10-12"; 13 pyproject = true; 14 # from `pdm show` 15 realVersion = 16 let 17 tag = builtins.elemAt (lib.splitString "-" version) 0; 18 rev = lib.substring 0 7 src.rev; 19 in 20 "${tag}1.dev1+g${rev}"; 21 22 src = fetchFromGitHub { 23 owner = "amaranth-lang"; 24 repo = "amaranth-soc"; 25 rev = "5c43cf58f15d9cd9c69ff83c97997708d386b2dc"; 26 hash = "sha256-o9xjH/nmV7ovw6bQ6PaFGLcjz5gDGb+eQ9eGNRPnBV8="; 27 }; 28 29 build-system = [ pdm-backend ]; 30 dependencies = [ amaranth ]; 31 32 preBuild = '' 33 export PDM_BUILD_SCM_VERSION="${realVersion}" 34 ''; 35 36 passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; }; 37 38 meta = with lib; { 39 description = "System on Chip toolkit for Amaranth HDL"; 40 homepage = "https://github.com/amaranth-lang/amaranth-soc"; 41 license = licenses.bsd2; 42 maintainers = with maintainers; [ 43 thoughtpolice 44 pbsds 45 ]; 46 }; 47}