From 122faac1b5f160a861a93a72359a3b609fe2cf9f Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 7 Jul 2026 00:27:04 -0700 Subject: [PATCH] Generate .pc files for Nixery's missing dev outputs Nixery only installs outputsToInstall (out/bin), not dev outputs. The dev outputs contain the .pc files that pkg-config needs for wayland-sys, xkbcommon-sys, and alsa-sys. Generate minimal .pc files pointing at the .so files that ARE in the nix store, then combine with the existing nix store pkgconfig dirs. --- .tangled/workflows/check.yml | 49 ++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/.tangled/workflows/check.yml b/.tangled/workflows/check.yml index bd586672..c693b165 100644 --- a/.tangled/workflows/check.yml +++ b/.tangled/workflows/check.yml @@ -76,15 +76,48 @@ steps: exit 1 fi - - name: "clippy (bevy_ui)" + - name: "setup pkg-config" command: | set -euo pipefail - PKG_CONFIG_PATH="" + PCDIR=/tangled/workspace/.pc + mkdir -p "$PCDIR" + + # Nixery installs only outputsToInstall (typically out/bin), not dev + # outputs. The dev outputs contain the .pc files that pkg-config needs. + # Generate minimal .pc files pointing at the .so files that ARE in the + # nix store so pkg-config can resolve them for the bevy_ui feature. + gen_pc() { + local pc_name="$1" lib_name="${2:-$1}" + for d in /nix/store/*/lib; do + if [ -f "$d/lib${lib_name}.so" ]; then + printf 'Name: %s\nDescription: %s\nVersion: 1.0\nLibs: -L%s -l%s\n' \ + "$pc_name" "$pc_name" "$d" "$lib_name" > "$PCDIR/${pc_name}.pc" + echo "generated ${pc_name}.pc -> $d" + return + fi + done + echo "WARNING: lib${lib_name}.so not found in nix store" + } + + gen_pc wayland-client + gen_pc wayland-server + gen_pc wayland-cursor + gen_pc xkbcommon + gen_pc alsa asound + + # PKG_CONFIG_PATH = generated .pc files + nix store pkgconfig dirs + PP="$PCDIR" for d in /nix/store/*/lib/pkgconfig /nix/store/*/share/pkgconfig; do - [ -d "$d" ] && PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}$d" + [ -d "$d" ] && PP="$PP:$d" done - export PKG_CONFIG_PATH - echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" + + echo "export PKG_CONFIG_PATH=\"$PP\"" > /tangled/workspace/setup-pc.sh + echo "pkg-config setup complete" + + - name: "clippy (bevy_ui)" + command: | + set -euo pipefail + . /tangled/workspace/setup-pc.sh log=/tangled/workspace/clippy-bevy.log if cargo clippy --all-targets --features bevy_ui --quiet -- -D warnings > "$log" 2>&1; then echo "clippy (bevy_ui): OK" @@ -97,11 +130,7 @@ steps: - name: "bevy build" command: | set -euo pipefail - PKG_CONFIG_PATH="" - for d in /nix/store/*/lib/pkgconfig /nix/store/*/share/pkgconfig; do - [ -d "$d" ] && PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}$d" - done - export PKG_CONFIG_PATH + . /tangled/workspace/setup-pc.sh log=/tangled/workspace/bevy-build.log if cargo build --features bevy_ui --bin misaligned-bevy --quiet > "$log" 2>&1; then echo "bevy build: OK" -- 2.51.2