Skip to content

Commit e1c3eec

Browse files
committed
chore: prepare yosys pybind11 updates
1 parent d8e884c commit e1c3eec

File tree

9 files changed

+58
-110
lines changed

9 files changed

+58
-110
lines changed

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
self.composePythonOverlay (pkgs': pkgs: pypkgs': pypkgs: let
6363
callPythonPackage = lib.callPackageWith (pkgs' // pypkgs');
6464
in {
65+
pybind11_3 = callPythonPackage ./nix/pybind11_3.nix {};
6566
cocotb = callPythonPackage ./nix/cocotb.nix {
6667
ghdl =
6768
if (lib.lists.any (el: el == pkgs'.system) pkgs'.ghdl-bin.meta.platforms)

nix/patches/yosys/abc-editline.patch

Lines changed: 0 additions & 14 deletions
This file was deleted.

nix/patches/yosys/new-bitwuzla.patch

Lines changed: 0 additions & 16 deletions
This file was deleted.

nix/patches/yosys/plugin-search-dirs.patch

Lines changed: 0 additions & 46 deletions
This file was deleted.

nix/pybind11_3.nix

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-License-Identifier: MIT
2+
# Copyright (c) 2025 nix-eda Contributors
3+
{
4+
lib,
5+
fetchPypi,
6+
buildPythonPackage,
7+
}:
8+
buildPythonPackage rec {
9+
pname = "pybind11";
10+
version = "3.0.1";
11+
format = "wheel";
12+
13+
src = fetchPypi {
14+
pname = "pybind11";
15+
inherit version;
16+
inherit format;
17+
dist = "py3";
18+
python = "py3";
19+
sha256 = "sha256-qo8KpuCpTTtkrfw49WDzPxXlib4hdeEDwKM8a85V7ok=";
20+
};
21+
}

nix/yosys-eqy.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
yosys-sby,
2323
python3,
2424
makeBinaryWrapper,
25-
version ? "0.54",
26-
sha256 ? "sha256-Km6layPDTAfd6oWnztJRdbiFkJeVT0YU06xWb/ewAms=",
25+
version ? "0.58",
26+
sha256 ? "sha256-bYcFIZRUk72mt0dN8wzpC+91nB+Xo0MXG6kmnzYURR4=",
2727
}:
2828
yosys.stdenv.mkDerivation (finalAttrs: {
2929
pname = "yosys-eqy";

nix/yosys-sby.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
boolector,
2020
z3,
2121
yices,
22-
version ? "0.54",
23-
sha256 ? "sha256-onVeK23KgCodEoaUtfh3R0MraaXuoNuQ2BAX5k4RNis=",
22+
version ? "0.58",
23+
sha256 ? "sha256-msQ+aqdp8i5KMLUABYU6vA5VBkI6G3zF06RrQzfJucY=",
2424
}:
2525
yosys.stdenv.mkDerivation (finalAttrs: {
2626
pname = "yosys-sby";

nix/yosys-slang.nix

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
# Copyright 2025 nix-eda Contributors
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
1+
# SPDX-License-Identifier: MIT
2+
# Copyright (c) 2025 nix-eda Contributors
143
{
154
lib,
165
yosys,

nix/yosys.nix

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@
5454
libffi,
5555
zlib,
5656
fetchurl,
57+
fetchGitHubSnapshot,
5758
bash,
58-
version ? "0.54",
59-
sha256 ? "sha256-meKlZh6ZiiPHwQCvS7Y667lvE9XWgIaual8c6SDpeDw=",
59+
version ? "0.59",
60+
rev ? "e86797f0297ef75826cebdd0e6f4cc51b7c77e0a",
61+
sha256 ? "sha256-08ZxWgYF+orLX6l97BBdYqAJ13Iq0gSex01Zfd8BPzE=",
6062
darwin, # To fix codesigning issue for pyosys
6163
# For environments
6264
yosys,
@@ -68,7 +70,7 @@
6870
python = python3;
6971
enablePython = true;
7072
};
71-
yosys-python3-env = python3.withPackages (ps: with ps; [click setuptools wheel]);
73+
yosys-python3-env = python3.withPackages (ps: with ps; [cxxheaderparser pybind11_3 click setuptools wheel]);
7274
site-packages = yosys-python3-env.sitePackages;
7375
in let
7476
self = clangStdenv.mkDerivation (finalAttrs: {
@@ -77,13 +79,30 @@ in let
7779

7880
outputs = ["out" "python"];
7981

80-
src = fetchurl {
81-
url = "https://github.com/YosysHQ/yosys/releases/download/v${version}/yosys.tar.gz";
82-
inherit sha256;
83-
};
82+
src =
83+
if rev != null
84+
then
85+
fetchGitHubSnapshot {
86+
owner = "yosyshq";
87+
repo = "yosys";
88+
inherit rev;
89+
hash = sha256;
90+
}
91+
else
92+
fetchurl {
93+
url = "https://github.com/YosysHQ/yosys/releases/download/v${version}/yosys.tar.gz";
94+
inherit sha256;
95+
};
8496

8597
unpackPhase = ''
86-
tar -xzvC . -f ${finalAttrs.src}
98+
runHook preUnpack
99+
if [ -d ${finalAttrs.src} ]; then
100+
cp -r ${finalAttrs.src}/* .
101+
chmod u+w -R .
102+
else
103+
tar -xzvC . -f ${finalAttrs.src} --strip-components=1
104+
fi
105+
runHook postUnpack
87106
'';
88107

89108
nativeBuildInputs =
@@ -100,7 +119,6 @@ in let
100119
libbsd
101120
libffi
102121
zlib
103-
boost-python
104122
];
105123

106124
buildInputs = [
@@ -125,15 +143,15 @@ in let
125143
postBuild = ''
126144
cat <<SCRIPT > $out/bin/with_yosys_plugin_env
127145
#!${bash}/bin/bash
128-
export NIX_YOSYS_PLUGIN_DIRS='$out/share/yosys/plugins'
146+
export YOSYS_PLUGIN_PATH='$out/share/yosys/plugins'
129147
exec "\$@"
130148
SCRIPT
131149
chmod +x $out/bin/with_yosys_plugin_env
132150
cp $out/bin/yosys $out/bin/yosys_with_plugins
133151
wrapProgram $out/bin/yosys \
134-
--set NIX_YOSYS_PLUGIN_DIRS $out/share/yosys/plugins
152+
--suffix YOSYS_PLUGIN_PATH : $out/share/yosys/plugins
135153
wrapProgram $out/bin/yosys_with_plugins \
136-
--set NIX_YOSYS_PLUGIN_DIRS $out/share/yosys/plugins \
154+
--suffix YOSYS_PLUGIN_PATH : $out/share/yosys/plugins \
137155
${module_flags}
138156
'';
139157
inherit (yosys) passthru;
@@ -157,11 +175,6 @@ in let
157175
"ENABLE_YOSYS=1"
158176
"ENABLE_PYOSYS=1"
159177
"PYTHON_DESTDIR=${placeholder "python"}/${site-packages}"
160-
"BOOST_PYTHON_LIB=${boost-python}/lib/libboost_${python3.pythonAttr}${clangStdenv.hostPlatform.extensions.sharedLibrary}"
161-
];
162-
163-
patches = [
164-
./patches/yosys/plugin-search-dirs.patch
165178
];
166179

167180
postPatch = ''

0 commit comments

Comments
 (0)