2024-05-07 20:52:12 -05:00
|
|
|
{
|
|
|
|
description = "A nix flake for the Yosys synthesis suite";
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
2024-05-10 17:42:53 -05:00
|
|
|
# TODO: don't override src when ./abc is empty
|
|
|
|
# which happens when the command used is `nix build` and not `nix build ?submodules=1`
|
|
|
|
abc-verifier = pkgs.abc-verifier.overrideAttrs(x: y: {src = ./abc;});
|
2024-05-21 05:50:23 -05:00
|
|
|
yosys = pkgs.clangStdenv.mkDerivation {
|
2024-05-07 20:52:12 -05:00
|
|
|
name = "yosys";
|
|
|
|
src = ./. ;
|
2024-07-22 13:11:08 -05:00
|
|
|
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git pkg-configUpstream llvmPackages.bintools ];
|
2024-05-07 20:52:12 -05:00
|
|
|
checkInputs = with pkgs; [ gtest ];
|
2024-05-10 17:42:53 -05:00
|
|
|
propagatedBuildInputs = [ abc-verifier ];
|
2024-05-07 20:52:12 -05:00
|
|
|
preConfigure = "make config-clang";
|
|
|
|
checkTarget = "test";
|
|
|
|
installPhase = ''
|
2024-05-10 17:42:53 -05:00
|
|
|
make install PREFIX=$out ABCEXTERNAL=yosys-abc
|
|
|
|
ln -s ${abc-verifier}/bin/abc $out/bin/yosys-abc
|
2024-05-07 20:52:12 -05:00
|
|
|
'';
|
|
|
|
buildPhase = ''
|
2024-05-10 17:42:53 -05:00
|
|
|
make -j$(nproc) ABCEXTERNAL=yosys-abc
|
2024-05-07 20:52:12 -05:00
|
|
|
'';
|
|
|
|
meta = with pkgs.lib; {
|
|
|
|
description = "Yosys Open SYnthesis Suite";
|
|
|
|
homepage = "https://yosyshq.net/yosys/";
|
|
|
|
license = licenses.isc;
|
|
|
|
maintainers = with maintainers; [ ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in {
|
2024-05-21 05:50:23 -05:00
|
|
|
packages.default = yosys;
|
|
|
|
defaultPackage = yosys;
|
2024-05-07 20:52:12 -05:00
|
|
|
devShell = pkgs.mkShell {
|
2024-07-09 04:25:16 -05:00
|
|
|
buildInputs = with pkgs; [ clang llvmPackages.bintools bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git gtest abc-verifier ];
|
2024-05-07 20:52:12 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|