git.iko.soy/typeable/nixpkgs
on master help sign in
init: experimental yosys-{bluespec, ghdl} plugins

These plugins can be included in a closure, along with the `yosys` derivation, and they will be automatically picked up for use. For example, this allows you to include 'yosys-bluespec' in your `buildInputs`, and then immediately run: $ nix-shell -p yosys yosys-bluespec yosys-ghdl $ yosys -m bluespec -p 'help read_bluespec' $ yosys -m ghdl -p 'help ghdl' These two plugins are a bit experimental, admittedly, but they are good, clean examples of how to write and use the yosys plugin infrastructure, and make it easy to test updates, etc. Signed-off-by: Austin Seipp <aseipp@pobox.com>

commitec1830e696fce7a92e230ee28e6deb3c53bee1a1 authorAustin Seipp <aseipp@pobox.com> dateThu 14 Jan 2021, 23:52 (6 years ago) parent2660037
3 files changed+65
pkgs/development/compilers/yosys/plugins/bluespec.nix+32 pkgs/development/compilers/yosys/plugins/ghdl.nix+31 pkgs/top-level/all-packages.nix+2
pkgs/development/compilers/yosys/plugins/bluespec.nixnew file+32
@@ -0,0 +1,32 @@
1+{ stdenv, lib, fetchFromGitHub, pkg-config
2+, yosys, readline, zlib, bluespec
3+}:
4+
5+stdenv.mkDerivation {
6+ pname = "yosys-bluespec";
7+ version = "2021.01.14";
8+
9+ src = fetchFromGitHub {
10+ owner = "thoughtpolice";
11+ repo = "yosys-bluespec";
12+ rev = "7a0c609e9b601560067c34b8ce41e89ea4a397d4";
13+ sha256 = "0xj9j5dwvq0dwqzfjd4ikmxkd28amj6d9m6ava7pwcrpjhyjnd0c";
14+ };
15+
16+ buildInputs = [ yosys readline zlib bluespec ];
17+ nativeBuildInputs = [ pkg-config ];
18+
19+ doCheck = true;
20+ makeFlags = [
21+ "PREFIX=$(out)/share/yosys/plugins"
22+ "STATIC_BSC_PATH=${bluespec}/bin/bsc"
23+ "STATIC_BSC_LIBDIR=${bluespec}/lib"
24+ ];
25+
26+ meta = with lib; {
27+ description = "Bluespec plugin for Yosys";
28+ license = licenses.isc;
29+ platforms = platforms.all;
30+ maintainers = with maintainers; [ thoughtpolice ];
31+ };
32+}
pkgs/development/compilers/yosys/plugins/ghdl.nixnew file+31
@@ -0,0 +1,31 @@
1+{ stdenv, lib, fetchFromGitHub, pkg-config
2+, yosys, readline, zlib, ghdl
3+}:
4+
5+stdenv.mkDerivation {
6+ pname = "yosys-ghdl";
7+ version = "2021.01.01";
8+
9+ src = fetchFromGitHub {
10+ owner = "ghdl";
11+ repo = "ghdl-yosys-plugin";
12+ rev = "8b3e740fef9a653a20a838f1ade475960e1d379b";
13+ sha256 = "13kpcp37r11xgqd8aksddi40a5vpzqi7p8qgyjbs99lyscyli75x";
14+ };
15+
16+ buildInputs = [ yosys readline zlib ghdl ];
17+ nativeBuildInputs = [ pkg-config ];
18+
19+ doCheck = true;
20+ installPhase = ''
21+ mkdir -p $out/share/yosys/plugins
22+ cp ghdl.so $out/share/yosys/plugins/ghdl.so
23+ '';
24+
25+ meta = with lib; {
26+ description = "GHDL plugin for Yosys";
27+ license = licenses.isc;
28+ platforms = platforms.all;
29+ maintainers = with maintainers; [ thoughtpolice ];
30+ };
31+}
pkgs/top-level/all-packages.nix+2
@@ -10832,6 +10832,8 @@ in
1083210832 yasm = callPackage ../development/compilers/yasm { };
1083310833
1083410834 yosys = callPackage ../development/compilers/yosys { };
10835+ yosys-bluespec = callPackage ../development/compilers/yosys/plugins/bluespec.nix { };
10836+ yosys-ghdl = callPackage ../development/compilers/yosys/plugins/ghdl.nix { };
1083510837
1083610838 z88dk = callPackage ../development/compilers/z88dk { };
1083710839