Add devShell to flake.nix. Build every available stable architecture. Remove shell.nix. Add nix github action

This commit is contained in:
Roland Coeurjoly 2024-03-01 11:18:13 +01:00
parent 4459409d73
commit 8b486df059
3 changed files with 59 additions and 84 deletions

13
.github/workflows/nix.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: "build nix flake"
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: cachix/install-nix-action@v25
- run: nix build '.?submodules=1'

View File

@ -23,47 +23,57 @@
};
enableGui = false;
in
{
packages = {
nextpnr = pkgs.stdenv.mkDerivation {
pname = "nextpnr";
version = "0.6";
src = ./.;
{
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)
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.tcl
pkgs.zlib
pkgs.capnproto
pkgs.lzma
pkgs.tk
pkgs.wget
] ++ (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");
cmakeFlags = [
"-DARCH=all"
"-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 ];
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; [ ];
};
};
};
};
packages.default = self.packages.${system}.nextpnr;
});
packages.default = self.packages.${system}.nextpnr;
devShell = pkgs.mkShell {
buildInputs = [ self.packages.${system}.default ];
};
});
}

View File

@ -1,48 +0,0 @@
{ pkgs ? import (fetchTarball https://github.com/NixOS/nixpkgs/archive/23.05.tar.gz) {} }:
let
pythonPkgs = pkgs.python3Packages;
boostPython = pkgs.boost.override { python = pythonPkgs.python; enablePython = true; };
vscode = pkgs.vscode-with-extensions.override {
vscodeExtensions = with pkgs.vscode-extensions; [
bbenoist.nix
ms-vscode.cpptools
ms-vscode.cmake-tools
twxs.cmake
usernamehw.errorlens
llvm-vs-code-extensions.vscode-clangd
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "VerilogHDL";
publisher = "mshr-h";
version = "1.11.4";
sha256 = "sha256-4JY0eaN2IkwHv8u8X6ejDXk6vT1qB4vJjWdIy8b/jj4=";
}
];
};
in pkgs.mkShell {
buildInputs = with pkgs; [
cmake
eigen
boostPython
pythonPkgs.python
pythonPkgs.apycula
libsForQt5.qt5.qtbase
llvmPackages.openmp
icestorm
trellis
mold
yosys
clang
valgrind
cling
gdb
vscode
];
shellHook = ''
export TRELLIS_INSTALL_PREFIX=${pkgs.trellis}
export ICESTORM_INSTALL_PREFIX=${pkgs.icestorm}
export QT_QPA_PLATFORM_PLUGIN_PATH="${pkgs.libsForQt5.qt5.qtbase.bin}/lib/qt-${pkgs.libsForQt5.qt5.qtbase.version}/plugins";
'';
}