Skip to content

Commit b6e546a

Browse files
committed
chore: prepare yosys pybind11 updates
[skip ci]
1 parent 728711a commit b6e546a

File tree

8 files changed

+56
-96
lines changed

8 files changed

+56
-96
lines changed

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
callPythonPackage = lib.callPackageWith (pkgs' // pypkgs');
7171
in
7272
{
73+
pybind11_3 = callPythonPackage ./nix/pybind11_3.nix { };
7374
cocotb = callPythonPackage ./nix/cocotb.nix {
7475
ghdl =
7576
if (lib.lists.any (el: el == pkgs'.system) pkgs'.ghdl-bin.meta.platforms) then

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
@@ -30,8 +30,8 @@
3030
yosys-sby,
3131
python3,
3232
makeBinaryWrapper,
33-
version ? "0.54",
34-
sha256 ? "sha256-Km6layPDTAfd6oWnztJRdbiFkJeVT0YU06xWb/ewAms=",
33+
version ? "0.58",
34+
sha256 ? "sha256-bYcFIZRUk72mt0dN8wzpC+91nB+Xo0MXG6kmnzYURR4=",
3535
}:
3636
yosys.stdenv.mkDerivation (finalAttrs: {
3737
pname = "yosys-eqy";

nix/yosys-sby.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
boolector,
2929
z3,
3030
yices,
31-
version ? "0.54",
32-
sha256 ? "sha256-onVeK23KgCodEoaUtfh3R0MraaXuoNuQ2BAX5k4RNis=",
31+
version ? "0.58",
32+
sha256 ? "sha256-msQ+aqdp8i5KMLUABYU6vA5VBkI6G3zF06RrQzfJucY=",
3333
}:
3434
yosys.stdenv.mkDerivation (finalAttrs: {
3535
pname = "yosys-sby";

nix/yosys.nix

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
libffi,
3838
zlib,
3939
fetchurl,
40+
fetchGitHubSnapshot,
4041
bash,
41-
version ? "0.54",
42-
sha256 ? "sha256-meKlZh6ZiiPHwQCvS7Y667lvE9XWgIaual8c6SDpeDw=",
42+
version ? "0.59",
43+
rev ? "e86797f0297ef75826cebdd0e6f4cc51b7c77e0a",
44+
sha256 ? "sha256-08ZxWgYF+orLX6l97BBdYqAJ13Iq0gSex01Zfd8BPzE=",
4345
darwin, # To fix codesigning issue for pyosys
4446
# For environments
4547
yosys,
@@ -54,6 +56,8 @@ let
5456
};
5557
yosys-python3-env = python3.withPackages (
5658
ps: with ps; [
59+
cxxheaderparser
60+
pybind11_3
5761
click
5862
setuptools
5963
wheel
@@ -71,13 +75,29 @@ let
7175
"python"
7276
];
7377

74-
src = fetchurl {
75-
url = "https://github.com/YosysHQ/yosys/releases/download/v${version}/yosys.tar.gz";
76-
inherit sha256;
77-
};
78+
src =
79+
if rev != null then
80+
fetchGitHubSnapshot {
81+
owner = "yosyshq";
82+
repo = "yosys";
83+
inherit rev;
84+
hash = sha256;
85+
}
86+
else
87+
fetchurl {
88+
url = "https://github.com/YosysHQ/yosys/releases/download/v${version}/yosys.tar.gz";
89+
inherit sha256;
90+
};
7891

7992
unpackPhase = ''
80-
tar -xzvC . -f ${finalAttrs.src}
93+
runHook preUnpack
94+
if [ -d ${finalAttrs.src} ]; then
95+
cp -r ${finalAttrs.src}/* .
96+
chmod u+w -R .
97+
else
98+
tar -xzvC . -f ${finalAttrs.src} --strip-components=1
99+
fi
100+
runHook postUnpack
81101
'';
82102

83103
nativeBuildInputs = [
@@ -92,7 +112,6 @@ let
92112
libbsd
93113
libffi
94114
zlib
95-
boost-python
96115
];
97116

98117
buildInputs = [
@@ -121,15 +140,15 @@ let
121140
postBuild = ''
122141
cat <<SCRIPT > $out/bin/with_yosys_plugin_env
123142
#!${bash}/bin/bash
124-
export NIX_YOSYS_PLUGIN_DIRS='$out/share/yosys/plugins'
143+
export YOSYS_PLUGIN_PATH='$out/share/yosys/plugins'
125144
exec "\$@"
126145
SCRIPT
127146
chmod +x $out/bin/with_yosys_plugin_env
128147
cp $out/bin/yosys $out/bin/yosys_with_plugins
129148
wrapProgram $out/bin/yosys \
130-
--set NIX_YOSYS_PLUGIN_DIRS $out/share/yosys/plugins
149+
--suffix YOSYS_PLUGIN_PATH : $out/share/yosys/plugins
131150
wrapProgram $out/bin/yosys_with_plugins \
132-
--set NIX_YOSYS_PLUGIN_DIRS $out/share/yosys/plugins \
151+
--suffix YOSYS_PLUGIN_PATH : $out/share/yosys/plugins \
133152
${module_flags}
134153
'';
135154
inherit (yosys) passthru;
@@ -153,11 +172,6 @@ let
153172
"ENABLE_YOSYS=1"
154173
"ENABLE_PYOSYS=1"
155174
"PYTHON_DESTDIR=${placeholder "python"}/${site-packages}"
156-
"BOOST_PYTHON_LIB=${boost-python}/lib/libboost_${python3.pythonAttr}${clangStdenv.hostPlatform.extensions.sharedLibrary}"
157-
];
158-
159-
patches = [
160-
./patches/yosys/plugin-search-dirs.patch
161175
];
162176

163177
postPatch = ''

0 commit comments

Comments
 (0)