mirror of
https://github.com/icewind1991/cynthion-flake.git
synced 2026-06-03 14:24:07 +02:00
split gateware building into individual derivations
This commit is contained in:
parent
bd43c82cae
commit
3e9035e7b5
3 changed files with 56 additions and 35 deletions
|
|
@ -6,6 +6,7 @@ final: prev: {
|
|||
apollo-cynthion = final.python-cynthion.pkgs.callPackage ./pkgs/cynthion/apollo-firmware.nix {board = "cynthion";};
|
||||
cynthion = final.callPackage ./pkgs/cynthion {};
|
||||
cynthion-unwrapped = final.python-cynthion.pkgs.callPackage ./pkgs/cynthion/cynthion.nix {};
|
||||
cynthion-gateware-single = final.callPackage ./pkgs/cynthion/single-gateware.nix {};
|
||||
cynthion-gateware = final.callPackage ./pkgs/cynthion/gateware.nix {};
|
||||
cynthion-moondancer = final.callPackage ./pkgs/cynthion/moondancer-bin.nix {};
|
||||
cynthion-udev = final.callPackage ./pkgs/cynthion/udev.nix {};
|
||||
|
|
|
|||
|
|
@ -1,39 +1,18 @@
|
|||
{
|
||||
stdenvNoCC,
|
||||
symlinkJoin,
|
||||
cynthion-gateware-single,
|
||||
cynthion-unwrapped,
|
||||
zsh,
|
||||
yosys,
|
||||
nextpnr,
|
||||
trellis,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "cynthion-gateware";
|
||||
inherit (cynthion-unwrapped) version src;
|
||||
dontFixup = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cynthion-unwrapped
|
||||
yosys
|
||||
nextpnr
|
||||
trellis
|
||||
zsh
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
cd cynthion/python
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
make -j $NIX_BUILD_CORES SHELL=zsh bitstreams
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share
|
||||
cp -r assets $out/share
|
||||
'';
|
||||
}: let
|
||||
inherit (lib) crossLists;
|
||||
platformVersions = ["0D1" "0D2" "0D3" "0D4" "0D5" "0D6" "0D7" "1D0" "1D1" "1D2" "1D3" "1D4"];
|
||||
bitstreams = ["analyzer" "selftest" "facedancer"];
|
||||
gatewares = crossLists (platform: bitstream: (cynthion-gateware-single.override {
|
||||
inherit bitstream;
|
||||
platform = "CynthionPlatformRev${platform}";
|
||||
})) [platformVersions bitstreams];
|
||||
in symlinkJoin {
|
||||
name = "cynthion-gateware-${cynthion-unwrapped.version}";
|
||||
paths = gatewares;
|
||||
}
|
||||
|
|
|
|||
41
pkgs/cynthion/single-gateware.nix
Normal file
41
pkgs/cynthion/single-gateware.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
stdenvNoCC,
|
||||
cynthion-unwrapped,
|
||||
zsh,
|
||||
yosys,
|
||||
nextpnr,
|
||||
trellis,
|
||||
bitstream ? null,
|
||||
platform ? null,
|
||||
...
|
||||
}: stdenvNoCC.mkDerivation {
|
||||
pname = "cynthion-gateware-${bitstream}";
|
||||
version = "${cynthion-unwrapped.version}-${platform}";
|
||||
|
||||
inherit (cynthion-unwrapped) src;
|
||||
dontFixup = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cynthion-unwrapped
|
||||
yosys
|
||||
nextpnr
|
||||
trellis
|
||||
zsh
|
||||
];
|
||||
|
||||
LUNA_PLATFORM = "cynthion.gateware.platform:${platform}";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mkdir -p assets/${platform}
|
||||
python -m cynthion.gateware.${bitstream}.top --dry-run --output assets/${platform}/${bitstream}.bit
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share
|
||||
cp -r assets $out/share
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue