packages/cynthion: Build bitstreams
This commit is contained in:
parent
2a1528fdab
commit
beb7e02f11
|
@ -1,4 +1,12 @@
|
|||
{ fetchFromGitHub, python3 }:
|
||||
{
|
||||
fetchFromGitHub,
|
||||
python3,
|
||||
zsh,
|
||||
stdenv,
|
||||
yosys,
|
||||
nextpnr,
|
||||
trellis,
|
||||
}:
|
||||
|
||||
let
|
||||
pyfwup = python3.pkgs.buildPythonPackage rec {
|
||||
|
@ -174,42 +182,76 @@ let
|
|||
rev = version;
|
||||
hash = "sha256-eLimS2gghT52tV01ZlFs8xEwwibB4yezl3eW7zrHpW8=";
|
||||
};
|
||||
cynthion = python3.pkgs.buildPythonApplication {
|
||||
pname = "cynthion";
|
||||
inherit version src;
|
||||
|
||||
sourceRoot = "${src.name}/cynthion/python";
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace-fail '"setuptools-git-versioning<2"' "" \
|
||||
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install -D assets/54-cynthion.rules $out/lib/udev/rules.d/54-cynthion.rules
|
||||
'';
|
||||
|
||||
pyproject = true;
|
||||
nativeBuildInputs = with python3.pkgs; [ setuptools ];
|
||||
propagatedBuildInputs =
|
||||
[
|
||||
amaranth
|
||||
apollo-fpga
|
||||
pyfwup
|
||||
pygreat
|
||||
luna-usb
|
||||
luna-soc
|
||||
]
|
||||
++ (with python3.pkgs; [
|
||||
future
|
||||
libusb1
|
||||
prompt-toolkit
|
||||
pyserial
|
||||
pyusb
|
||||
tabulate
|
||||
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
|
||||
python3.pkgs.buildPythonApplication {
|
||||
pname = "cynthion";
|
||||
inherit version src;
|
||||
|
||||
sourceRoot = "${src.name}/cynthion/python";
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace-fail '"setuptools-git-versioning<2"' "" \
|
||||
--replace-fail 'dynamic = ["version"]' 'version = "${version}"'
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install -D assets/54-cynthion.rules $out/lib/udev/rules.d/54-cynthion.rules
|
||||
'';
|
||||
|
||||
pyproject = true;
|
||||
nativeBuildInputs = with python3.pkgs; [ setuptools ];
|
||||
propagatedBuildInputs =
|
||||
[
|
||||
amaranth
|
||||
apollo-fpga
|
||||
pyfwup
|
||||
pygreat
|
||||
luna-usb
|
||||
luna-soc
|
||||
]
|
||||
++ (with python3.pkgs; [
|
||||
future
|
||||
libusb1
|
||||
prompt-toolkit
|
||||
pyserial
|
||||
pyusb
|
||||
tabulate
|
||||
tomli
|
||||
tqdm
|
||||
]);
|
||||
}
|
||||
cynthion.overrideAttrs (attrs: {
|
||||
postPatch =
|
||||
attrs.postPatch
|
||||
+ ''
|
||||
ln -s ${cynthion-bitstreams}/* assets
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue