Add Gowin FPGA toolchain for desktop development.

Vendor Gowin EDU IDE, add openFPGALoader/Yosys/nextpnr/Apicula, and USB udev rules for Tang boards.
This commit is contained in:
WHC
2026-09-19 18:34:38 +08:00
parent e9aa3124fe
commit cac29b4c79
11 changed files with 296 additions and 28 deletions
+58
View File
@@ -0,0 +1,58 @@
{
lib,
buildFHSEnv,
freetype,
xkeyboard_config,
callPackage,
}:
let
gowin-ide = callPackage ./gowin-ide.nix { };
in
buildFHSEnv {
name = "gowin-env";
targetPkgs =
pkgs:
# ldd /nix/store/*gowin-version/bin/gw_ide
with pkgs; [
gowin-ide
# runtime dependencies
libGL
fontconfig
libxcrypt-legacy
zlib
libuuid
libpulseaudio
glib
dbus
libusb1
nss
nspr
expat
krb5
libxcomposite
libxdamage
libxfixes
libxtst
udev
alsa-lib
vulkan-loader
libx11
libxcursor
libxi
libxrandr
libxkbcommon
wayland
qt5.qtwayland
qt5.qtbase
];
profile = ''
export LD_PRELOAD="${lib.getLib freetype}/lib/libfreetype.so"
export QT_XKB_CONFIG_ROOT="${xkeyboard_config}/etc/X11/xkb"
export QT_QPA_PLATFORM=xcb
export FHS=1
gw_ide
'';
}
+55
View File
@@ -0,0 +1,55 @@
{
fetchurl,
lib,
stdenv,
qt5,
}:
stdenv.mkDerivation rec {
pname = "gowin-eda-edu-ide";
version = "1.9.11.01";
src = fetchurl {
# https://www.gowinsemi.com.cn/faq.aspx
url = "https://cdn.gowinsemi.com.cn/Gowin_V${version}_Education_Linux.tar.gz";
sha256 = "sha256-I26TSznMquS74NZzgJtRDMQ4V9hg7z4WCSJ0ybkvrQ4=";
};
sourceRoot = ".";
buildInputs = [qt5.qtbase];
nativeBuildInputs = [qt5.wrapQtAppsHook];
installPhase = ''
_package-ide() {
# install IDE
cd IDE
find doc/ -type f -exec install -Dm644 {} $out/{} \;
find lib/ -type f -exec install -Dm644 {} $out/{} \;
find data/ -type f -exec install -Dm644 {} $out/{} \;
find share/ -type f -exec install -Dm644 {} $out/{} \;
find simlib/ -type f -exec install -Dm644 {} $out/{} \;
find ipcore/ -type f -exec install -Dm644 {} $out/{} \;
find plugins/ -type f -exec install -Dm644 {} $out/{} \;
find bin/vhdl_packages -type f -exec install -Dm644 {} $out/{} \;
find bin/ -type f -exec install -Dm755 {} $out/{} \;
chmod 644 $out/bin/prim{itive.xml,_syn.vhd,_syn.v}
chmod 644 $out/bin/qt.conf
chmod 644 $out/bin/programmer.json
# fix ide launch error
# libfreetype.so.6 from Gowin EDA ide could cause error when launch the IDE:
# /opt/gowin-eda-edu-ide/bin/gw_ide: symbol lookup error: /usr/lib/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var
#
# https://bbs.archlinux.org/viewtopic.php?id=251445
# https://mathematica.stackexchange.com/questions/189306/cant-launch-mathematica-11-on-fedora-29
rm -f $out/lib/libfreetype.so.6
}
_package-ide
'';
meta = with lib; {
description = "Gowin EDA, an easy to use integrated design environment provides design engineers one-stop solution from design entry to verification. (education version)";
homepage = "http://www.gowinsemi.com.cn/faq.aspx";
maintainers = with maintainers; [];
};
}