nixpkgs/pkgs/development/compilers/silice/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
2.6 KiB
Nix
Raw Normal View History

2022-08-05 23:22:01 +02:00
{ stdenv, fetchFromGitHub, lib
, cmake, pkg-config, openjdk
, libuuid, python3
, glfw
2024-07-04 18:22:19 +02:00
, yosys, nextpnr, verilator
2022-08-05 23:22:01 +02:00
, dfu-util, icestorm, trellis
, unstableGitUpdater
2022-08-05 23:22:01 +02:00
}:
2024-07-04 18:22:19 +02:00
stdenv.mkDerivation (finalAttrs: {
2022-08-05 23:22:01 +02:00
pname = "silice";
version = "0-unstable-2024-07-22";
2022-08-05 23:22:01 +02:00
src = fetchFromGitHub {
owner = "sylefeb";
2024-07-04 18:22:19 +02:00
repo = "silice";
rev = "8f56349f8b143d5a4b9686b1782f1ae66e011be4";
hash = "sha256-1y2q41XyQLxjUkWKh8Ky/t3uaQXkm0IgMk9r06vKcRg=";
2022-08-05 23:22:01 +02:00
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
pkg-config
openjdk
glfw
2022-08-05 23:22:01 +02:00
];
buildInputs = [
libuuid
];
propagatedBuildInputs = [
(python3.withPackages (p: [
p.edalize
p.termcolor
]))
2022-08-05 23:22:01 +02:00
];
postPatch = ''
patchShebangs antlr/antlr.sh
# use nixpkgs version
rm -r python/pybind11
'';
installPhase = ''
2024-07-04 18:22:19 +02:00
runHook preInstall
2022-08-05 23:22:01 +02:00
make install
mkdir -p $out
cp -ar ../{bin,frameworks,lib} $out/
2024-07-04 18:22:19 +02:00
runHook postInstall
2022-08-05 23:22:01 +02:00
'';
passthru.tests =
let
2024-07-04 18:22:19 +02:00
silice = finalAttrs.finalPackage;
2022-08-05 23:22:01 +02:00
testProject = project: stdenv.mkDerivation {
name = "${silice.name}-test-${project}";
nativeBuildInputs = [
silice
yosys
nextpnr
verilator
dfu-util
icestorm
trellis
];
2024-07-04 18:22:19 +02:00
src = "${silice.src}/projects";
2022-08-05 23:22:01 +02:00
sourceRoot = "projects/${project}";
buildPhase = ''
2024-07-04 18:22:19 +02:00
targets=()
for target in $(cat configs | tr -d '\r') ; do
[[ $target != Makefile* ]] || continue
2022-08-05 23:22:01 +02:00
make $target ARGS="--no_program"
2024-07-04 18:22:19 +02:00
targets+=($target)
2022-08-05 23:22:01 +02:00
done
2024-07-04 18:22:19 +02:00
if test "''${#targets[@]}" -eq 0; then
>&2 echo "ERROR: no target found!"
false
fi
2022-08-05 23:22:01 +02:00
'';
installPhase = ''
mkdir $out
2024-07-04 18:22:19 +02:00
for target in "''${targets[@]}" ; do
[[ $target != Makefile* ]] || continue
2022-08-05 23:22:01 +02:00
done
'';
};
in {
# a selection of test projects that build with the FPGA tools in
# nixpkgs
audio_sdcard_streamer = testProject "audio_sdcard_streamer";
bram_interface = testProject "bram_interface";
blinky = testProject "blinky";
pipeline_sort = testProject "pipeline_sort";
};
passthru.updateScript = unstableGitUpdater { };
2024-07-04 18:22:19 +02:00
meta = {
2022-08-05 23:22:01 +02:00
description = "Open source language that simplifies prototyping and writing algorithms on FPGA architectures";
homepage = "https://github.com/sylefeb/Silice";
2024-07-04 18:22:19 +02:00
license = lib.licenses.bsd2;
mainProgram = "silice";
maintainers = with lib.maintainers; [
astro
pbsds
];
platforms = lib.platforms.all;
2022-08-05 23:22:01 +02:00
};
2024-07-04 18:22:19 +02:00
})