{ pkgs ? import { } }: # The spike's own environment. Deliberately NOT in the repo's main flake: the # production flake stays free of Rust, pywayland-scanner and libjpeg-turbo # until the verdict says which of them the winner actually needs. let python = pkgs.python3.withPackages (ps: [ ps.pywayland ps.cffi ps.matplotlib ]); in pkgs.mkShell { packages = [ python python.pkgs.pywayland # brings `pywayland-scanner` for the protocol bindings pkgs.wayland # the core wayland.xml pkgs.wayland-scanner # `wayland-scanner` itself, which pywayland-scanner shells out to pkgs.wayland-protocols # the ext-image-copy-capture XML, staged pkgs.libjpeg_turbo # ctypes: turbojpeg, the encoder grim itself uses pkgs.pkg-config pkgs.jq pkgs.ffmpeg ]; shellHook = '' export SPIKE_ROOT="$PWD" export PYTHONPATH="$PWD/generated''${PYTHONPATH:+:$PYTHONPATH}" # `lib.getLib`, not the bare package: the bare attribute resolves to # libjpeg-turbo's *bin* output here, which has no shared library in it, and # ctypes then fails with "cannot open shared object file" pointing at a path # that looks right until you notice the `-bin` suffix. export TURBOJPEG_PATH="${pkgs.lib.getLib pkgs.libjpeg_turbo}/lib/libturbojpeg.so" export WAYLAND_DISPLAY="''${WAYLAND_DISPLAY:-/run/hypr-stream/wayland-1}" # `wayland.xml` ships in the **wayland-scanner** package, not in `wayland` # (whose store path is `lib` only) -- and not via pkg-config in an mkShell, # because `packages` does not put dev outputs on PKG_CONFIG_PATH. export WAYLAND_CORE_XML="${pkgs.wayland-scanner}/share/wayland/wayland.xml" export WAYLAND_PROTOCOLS_DIR="${pkgs.wayland-protocols}/share/wayland-protocols" echo "capture-speed spike env -- python $(python3 --version 2>&1 | cut -d' ' -f2)" echo " WAYLAND_DISPLAY=$WAYLAND_DISPLAY (do NOT set XDG_RUNTIME_DIR to the same dir)" echo " generated protocol bindings: $PWD/generated" ''; }