From 537f408abf80633050afb46f0fea680759e94128 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sun, 24 Aug 2025 19:20:32 +0300 Subject: [PATCH] qemu: Fix Python deps, the third time Hooks from `python` (specifically the one that adds `pythonPath`) are needed by `python/scripts/mkvenv.py` to find meson With `python.withPackages` ``` python determined to be '/nix/store/r98crvxg8pmrvx9vzymhlwbbvffnzjhl-python3-3.13.6-env/bin/python3' python version: Python 3.13.6 mkvenv: Creating non-isolated virtual environment (with packages from '/nix/store/r98crvxg8pmrvx9vzymhlwbbvffnzjhl-python3-3.13.6-env/lib/python3.13/site-packages') at 'pyvenv' mkvenv: checking for meson>=1.5.0 mkvenv: checking for pycotap>=1.1.0 mkvenv: installing meson==1.5.0, pycotap==1.3.1 ``` With `pythonPackages.python` ``` python version: Python 3.13.6 mkvenv: Creating non-isolated virtual environment at 'pyvenv' mkvenv: checking for meson>=1.5.0 mkvenv: checking for pycotap>=1.1.0 mkvenv: installing pycotap==1.3.1 ``` Here's a diff of the env-vars https://gist.github.com/Artturin/e79f1fcf125ebb138c0012008e719533 the `withPackages` without `pythonOnBuildForHost` was wrong too but changing it didn't fix the issue Fixes this error in qemu-user / qemu minimal ``` $ ./result/bin/qemu-aarch64 ./result/bin/qemu-aarch64: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory ``` Co-authored-by: dramforever --- pkgs/applications/virtualization/qemu/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index 98542ee3aabc..4e313ed8784c 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -169,8 +169,12 @@ stdenv.mkDerivation (finalAttrs: { ninja perl - # Don't change this to python3 and python3.pkgs.*, breaks cross-compilation - (python3Packages.python.withPackages (ps: with ps; [ distlib ])) + # For python changes other than simple package additions, ping @dramforever for review. + # Don't change `python3Packages` to `python3.pkgs.*`, breaks cross-compilation. + python3Packages.distlib + # Hooks from the python package are needed to add `$pythonPath` so + # `python/scripts/mkvenv.py` can detect `meson` otherwise the vendored meson without patches will be used. + python3Packages.python ] ++ lib.optionals gtkSupport [ wrapGAppsHook3 ] ++ lib.optionals enableDocs [