1
0
Fork 0
nix-scripts/gluelogic/default.nix

106 lines
3.4 KiB
Nix
Raw Normal View History

2019-07-03 23:01:31 +08:00
{ pkgs ? import <nixpkgs> {} }:
let
ise = import ./ise.nix { inherit pkgs; };
2024-06-06 14:40:33 +08:00
vivado = import ./vivado.nix { inherit pkgs; };
fpgatools = import ./fpgatools.nix { inherit pkgs; };
2019-11-14 16:34:25 +08:00
buildUrukulCpld = {version, src}: pkgs.stdenv.mkDerivation {
pname = "urukul-cpld";
inherit src version;
2024-06-06 14:40:33 +08:00
buildInputs = [(pkgs.python3.withPackages(ps: [fpgatools.migen]))] ++ (builtins.attrValues fpgatools.ise);
2019-11-14 16:34:25 +08:00
phases = ["buildPhase" "installPhase"];
buildPhase = "python $src/urukul_impl.py";
installPhase =
2019-11-14 16:34:25 +08:00
''
mkdir -p $out $out/nix-support
cp build/urukul.jed $out
echo file binary-dist $out/urukul.jed >> $out/nix-support/hydra-build-products
'';
};
2019-12-19 12:51:52 +08:00
buildMirnyCpld = {version, src}: pkgs.stdenv.mkDerivation {
pname = "mirny-cpld";
inherit src version;
2024-06-06 14:40:33 +08:00
buildInputs = [(pkgs.python3.withPackages(ps: [fpgatools.migen]))] ++ (builtins.attrValues fpgatools.ise);
2019-12-19 12:51:52 +08:00
phases = ["buildPhase" "installPhase"];
buildPhase = "python $src/mirny_impl.py";
installPhase =
2019-12-19 12:51:52 +08:00
''
mkdir -p $out $out/nix-support
cp build/mirny.jed $out
echo file binary-dist $out/mirny.jed >> $out/nix-support/hydra-build-products
'';
};
2019-07-03 23:01:31 +08:00
in
{
2019-11-14 16:34:25 +08:00
urukul-cpld-master = buildUrukulCpld {
version = "master";
2019-07-03 23:01:31 +08:00
src = <urukulSrc>;
2019-11-14 16:34:25 +08:00
};
urukul-cpld-release = buildUrukulCpld rec {
2020-04-03 17:30:00 +08:00
version = "1.4.0";
2019-11-14 16:34:25 +08:00
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "urukul";
rev = "v${version}";
2020-04-03 17:30:00 +08:00
sha256 = "1962jpzqzn22cwkcmfnvwqlj5i89pljhgfk64n6pk73clir9mp0w";
2019-11-14 16:34:25 +08:00
};
2019-07-03 23:01:31 +08:00
};
2020-06-24 19:08:52 +08:00
urukul-cpld-legacy = buildUrukulCpld rec {
version = "1.3.1";
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "urukul";
rev = "v${version}";
sha256 = "1nvarspqbf9f7b27j34jkkh4mj6rwrlmccmfpz5nnzk3h2j6zbqc";
};
};
2019-12-19 12:51:52 +08:00
mirny-cpld-master = buildMirnyCpld {
version = "master";
src = <mirnySrc>;
};
mirny-cpld-release = buildMirnyCpld rec {
2024-06-06 14:52:21 +08:00
version = "0.3";
2019-12-19 12:51:52 +08:00
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "mirny";
rev = "v${version}";
2024-06-06 14:52:21 +08:00
sha256 = "sha256-u1iXcbGX6JkVgfpnCbkyTOVoMYnYcSufLBb6OBAeu8c=";
2019-12-19 12:51:52 +08:00
};
};
2020-05-31 16:57:54 +08:00
fastino-fpga = pkgs.stdenv.mkDerivation {
name = "fastino-fpga";
src = <fastinoSrc>;
2024-06-06 14:40:33 +08:00
buildInputs = [(pkgs.python3.withPackages(ps: [fpgatools.migen fpgatools.misoc]))] ++ [pkgs.yosys pkgs.nextpnr pkgs.icestorm];
2020-05-31 16:57:54 +08:00
phases = ["buildPhase" "installPhase"];
buildPhase = "python $src/fastino_phy.py";
installPhase =
''
mkdir -p $out $out/nix-support
cp build/fastino.bin $out
echo file binary-dist $out/fastino.bin >> $out/nix-support/hydra-build-products
'';
};
2020-10-12 22:49:47 +08:00
phaser-fpga = pkgs.stdenv.mkDerivation {
name = "phaser-fpga";
src = <phaserSrc>;
patchPhase = ''
substituteInPlace phaser.py \
--replace "source ../load.tcl" \
""
'';
2020-10-12 22:49:47 +08:00
2024-06-06 14:40:33 +08:00
buildInputs = [ (pkgs.python3.withPackages(ps: [ fpgatools.migen fpgatools.misoc ])) ] ++ [ fpgatools.vivado ];
2020-10-12 22:49:47 +08:00
buildPhase = "python phaser.py";
installPhase =
''
mkdir -p $out $out/nix-support
cp build/phaser.bit $out
echo file binary-dist $out/phaser.bit >> $out/nix-support/hydra-build-products
'';
dontFixup = true;
doCheck = true;
checkInputs = [ pkgs.python3Packages.pytest ];
checkPhase = "pytest";
};
2019-07-03 23:01:31 +08:00
}