15 wrapQtAppsHook ? null,
21 boostPython = boost.override {
29 main_src = fetchFromGitHub {
32 rev = "${pname}-${version}";
33 hash = "sha256-YIAQcCg9RjvCys1bQ3x+sTgTmnmEeXVbt9Lr6wtg1pA=";
37 test_src = fetchFromGitHub {
39 repo = "nextpnr-tests";
40 rev = "00c55a9eb9ea2e062b51fe0d64741412b185d95d";
41 hash = "sha256-83suMftMtnaRFq3T2/I7Uahb11WZlXhwYt6Q/rqi2Yo=";
42 name = "nextpnr-tests";
46 stdenv.mkDerivation rec {
47 inherit pname version;
54 sourceRoot = main_src.name;
59 ] ++ (lib.optional enableGui wrapQtAppsHook);
64 python3Packages.apycula
66 ++ (lib.optional enableGui qtbase)
67 ++ (lib.optional stdenv.cc.isClang llvmPackages.openmp);
71 # the specified version must always start with "nextpnr-", so add it if
72 # missing (e.g. if the user overrides with a git hash)
74 version = if (lib.hasPrefix "nextpnr-" rev) then rev else "nextpnr-${rev}";
77 "-DCURRENT_GIT_VERSION=${version}"
78 "-DARCH=generic;ice40;ecp5;gowin;himbaechel"
80 "-DICESTORM_INSTALL_PREFIX=${icestorm}"
81 "-DTRELLIS_INSTALL_PREFIX=${trellis}"
82 "-DTRELLIS_LIBDIR=${trellis}/lib/trellis"
83 "-DGOWIN_BBA_EXECUTABLE=${python3Packages.apycula}/bin/gowin_bba"
85 # warning: high RAM usage
86 "-DSERIALIZE_CHIPDBS=OFF"
87 "-DHIMBAECHEL_GOWIN_DEVICES=all"
89 ++ (lib.optional enableGui "-DBUILD_GUI=ON")
91 enableGui && stdenv.hostPlatform.isDarwin
92 ) "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks");
94 patchPhase = with builtins; ''
95 # use PyPy for icestorm if enabled
96 substituteInPlace ./ice40/CMakeLists.txt \
97 --replace ''\'''${PYTHON_EXECUTABLE}' '${icestorm.pythonInterp}'
101 ln -s ../${test_src.name} tests
106 postFixup = lib.optionalString enableGui ''
107 wrapQtApp $out/bin/nextpnr-generic
108 wrapQtApp $out/bin/nextpnr-ice40
109 wrapQtApp $out/bin/nextpnr-ecp5
110 wrapQtApp $out/bin/nextpnr-gowin
111 wrapQtApp $out/bin/nextpnr-himbaechel
117 description = "Place and route tool for FPGAs";
118 homepage = "https://github.com/yosyshq/nextpnr";
119 license = licenses.isc;
120 platforms = platforms.all;
121 maintainers = with maintainers; [ thoughtpolice ];