packages/cynthion: Build bitstreams

This commit is contained in:
Artemis Tosini 2024-07-10 03:42:46 +00:00
parent 2a1528fdab
commit beb7e02f11
Signed by: artemist
GPG key ID: EE5227935FE3FF18

View file

@ -1,4 +1,12 @@
{ fetchFromGitHub, python3 }:
{
fetchFromGitHub,
python3,
zsh,
stdenv,
yosys,
nextpnr,
trellis,
}:
let
pyfwup = python3.pkgs.buildPythonPackage rec {
@ -174,8 +182,7 @@ let
rev = version;
hash = "sha256-eLimS2gghT52tV01ZlFs8xEwwibB4yezl3eW7zrHpW8=";
};
in
python3.pkgs.buildPythonApplication {
cynthion = python3.pkgs.buildPythonApplication {
pname = "cynthion";
inherit version src;
@ -212,4 +219,39 @@ python3.pkgs.buildPythonApplication {
tomli
tqdm
]);
}
};
cynthion-bitstreams = stdenv.mkDerivation rec {
pname = "cynthion-bistreams";
inherit version src;
sourceRoot = "${src.name}/cynthion/python";
postPatch = ''
substituteInPlace Makefile --replace-fail '/bin/zsh' '${zsh}/bin/zsh'
rm -r assets
mkdir assets
'';
nativeBuildInputs = [
python3
cynthion
yosys
nextpnr
trellis
];
buildPhase = ''
make bitstreams
'';
installPhase = ''
mv assets $out
'';
};
in
cynthion.overrideAttrs (attrs: {
postPatch =
attrs.postPatch
+ ''
ln -s ${cynthion-bitstreams}/* assets
'';
})