nixpkgs/pkgs/by-name/si/silice/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

125 lines
2.7 KiB
Nix

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