Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 33 additions & 50 deletions pkgs/by-name/ne/nextpnr/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
cmake,
boost,
python3,
Expand All @@ -15,7 +14,6 @@
enableGui ? false,
wrapQtAppsHook ? null,
qtbase ? null,
OpenGL ? null,
}:

let
Expand All @@ -25,42 +23,33 @@ let
};

pname = "nextpnr";
version = "0.7";
version = "0.8";

main_src = fetchFromGitHub {
owner = "YosysHQ";
repo = "nextpnr";
rev = "${pname}-${version}";
hash = "sha256-YIAQcCg9RjvCys1bQ3x+sTgTmnmEeXVbt9Lr6wtg1pA=";
name = "nextpnr";
prjxray_src = fetchFromGitHub {
owner = "f4pga";
repo = "prjxray";
rev = "faf9c774a340e39cf6802d009996ed6016e63521";
hash = "sha256-BEv7vJoOHWHZoc9EXbesfwFFClkuiSpVwHUrj4ahUcA=";
};

test_src = fetchFromGitHub {
owner = "YosysHQ";
repo = "nextpnr-tests";
rev = "00c55a9eb9ea2e062b51fe0d64741412b185d95d";
hash = "sha256-83suMftMtnaRFq3T2/I7Uahb11WZlXhwYt6Q/rqi2Yo=";
name = "nextpnr-tests";
prjbeyond_src = fetchFromGitHub {
owner = "YosysHQ-GmbH";
repo = "prjbeyond-db";
rev = "06d3b424dd0e52d678087c891c022544238fb9e3";
hash = "sha256-nmyFFUO+/J2lb+lPATEjdYq0d21P1fN3N94JXR8brZ0=";
};
in

stdenv.mkDerivation {
stdenv.mkDerivation rec {
inherit pname version;

srcs = [
main_src
test_src
];

sourceRoot = main_src.name;

patches = [
(fetchpatch {
name = "boost-1_85-fixes.patch";
url = "https://github.com/YosysHQ/nextpnr/commit/f085950383155a745cf2e3c0f28c468d01ff5fd7.patch";
hash = "sha256-ihN3S4eeBQSrKbHrGinE/SlIY3QDytYCaO9Mtu36n6c=";
})
];
src = fetchFromGitHub {
owner = "YosysHQ";
repo = "nextpnr";
tag = "${pname}-${version}";
hash = "sha256-lconcmLACxWxC41fTIkUaGbfp79G98YdHA4mRJ9Qo1w=";
fetchSubmodules = true;
};

nativeBuildInputs = [
cmake
Expand All @@ -79,35 +68,30 @@ stdenv.mkDerivation {
let
# the specified version must always start with "nextpnr-", so add it if
# missing (e.g. if the user overrides with a git hash)
rev = main_src.rev;
rev = src.rev;
version = if (lib.hasPrefix "nextpnr-" rev) then rev else "nextpnr-${rev}";
in
[
"-DCURRENT_GIT_VERSION=${version}"
"-DARCH=generic;ice40;ecp5;gowin;himbaechel"
"-DARCH=generic;ice40;ecp5;himbaechel"
"-DBUILD_TESTS=ON"
"-DICESTORM_INSTALL_PREFIX=${icestorm}"
"-DTRELLIS_INSTALL_PREFIX=${trellis}"
"-DTRELLIS_LIBDIR=${trellis}/lib/trellis"
"-DGOWIN_BBA_EXECUTABLE=${python3Packages.apycula}/bin/gowin_bba"
"-DUSE_OPENMP=ON"
# warning: high RAM usage
"-DSERIALIZE_CHIPDBS=OFF"
"-DHIMBAECHEL_UARCH=all"
"-DHIMBAECHEL_GOWIN_DEVICES=all"
"-DHIMBAECHEL_PRJXRAY_DB=${prjxray_src}"
"-DHIMBAECHEL_PRJBEYOND_DB=${prjbeyond_src}"
]
++ (lib.optional enableGui "-DBUILD_GUI=ON")
++ (lib.optional (
enableGui && stdenv.hostPlatform.isDarwin
) "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks");
++ (lib.optional enableGui "-DBUILD_GUI=ON");

postPatch = ''
# use PyPy for icestorm if enabled
substituteInPlace ./ice40/CMakeLists.txt \
--replace ''\'''${PYTHON_EXECUTABLE}' '${icestorm.pythonInterp}'
'';

preBuild = ''
ln -s ../${test_src.name} tests
# Don't use #embed macro for chipdb binary embeddings - otherwise getting spurious type narrowing errors.
# Maybe related to: https://github.com/llvm/llvm-project/issues/119256
substituteInPlace CMakeLists.txt \
--replace-fail "check_cxx_compiler_hash_embed(HAS_HASH_EMBED CXX_FLAGS_HASH_EMBED)" ""
'';

doCheck = true;
Expand All @@ -116,17 +100,16 @@ stdenv.mkDerivation {
wrapQtApp $out/bin/nextpnr-generic
wrapQtApp $out/bin/nextpnr-ice40
wrapQtApp $out/bin/nextpnr-ecp5
wrapQtApp $out/bin/nextpnr-gowin
wrapQtApp $out/bin/nextpnr-himbaechel
'';

strictDeps = true;

meta = with lib; {
meta = {
description = "Place and route tool for FPGAs";
homepage = "https://github.com/yosyshq/nextpnr";
license = licenses.isc;
platforms = platforms.all;
maintainers = with maintainers; [ thoughtpolice ];
license = lib.licenses.isc;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ thoughtpolice ];
};
}
1 change: 0 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6827,7 +6827,6 @@ with pkgs;

nextpnrWithGui = libsForQt5.callPackage ../by-name/ne/nextpnr/package.nix {
enableGui = true;
inherit (darwin.apple_sdk.frameworks) OpenGL;
};

obliv-c = callPackage ../development/compilers/obliv-c {
Expand Down