Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ install_manifest.txt
*.phys
*.dcp
*.bit
result
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
description = "A flake for the nextpnr FPGA place and route tool";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [];
};
# Define custom overrides or additional packages
myPythonPackages = pkgs.python3Packages.override {
overrides = self: super: {
apycula = super.apycula.override {
# Place any necessary overrides here
};
};
};
enableGui = false;
in
{
packages = {
nextpnr = pkgs.stdenv.mkDerivation {
pname = "nextpnr";
version = "0.6";
src = ./.;

nativeBuildInputs = [ pkgs.cmake ]
++ (pkgs.lib.optional enableGui pkgs.qt6.wrapQtAppsHook);
buildInputs = [
(pkgs.boost.override { python = pkgs.python3; enablePython = true; })
pkgs.python3
pkgs.eigen
myPythonPackages.apycula
pkgs.icestorm
pkgs.trellis
] ++ (pkgs.lib.optional enableGui pkgs.qt6.qtbase)
++ (pkgs.lib.optional pkgs.stdenv.cc.isClang pkgs.llvmPackages.openmp);

cmakeFlags = [
"-DARCH=generic;ice40;ecp5;gowin"
"-DBUILD_TESTS=ON"
"-DICESTORM_INSTALL_PREFIX=${pkgs.icestorm}"
"-DTRELLIS_INSTALL_PREFIX=${pkgs.trellis}"
"-DTRELLIS_LIBDIR=${pkgs.trellis}/lib/trellis"
"-DGOWIN_BBA_EXECUTABLE=${myPythonPackages.apycula}/bin/gowin_bba"
"-DUSE_OPENMP=ON"
# warning: high RAM usage
"-DSERIALIZE_CHIPDBS=OFF"
] ++ (pkgs.lib.optional enableGui "-DBUILD_GUI=ON");

meta = with pkgs.lib; {
description = "Place and route tool for FPGAs";
homepage = "https://github.com/yosyshq/nextpnr";
license = licenses.isc;
platforms = platforms.all;
maintainers = with maintainers; [ thoughtpolice emily ];
};
};
};

packages.default = self.packages.${system}.nextpnr;
});
}