How do you set the PKG_CONFIG_PATH environment variable to reference the directory containing wayland-client.pc?
Context
My NixOS installation is running a desktop environment using Wayland. It also has a configuration.nix file with the following pertinent contents:
{ config, pkgs, … }: {
…
hardware.graphics = {
enable = true;
enable32Bit = true;
};
…
environment.sessionVariables = rec {
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (with pkgs; [
wayland
pkg-config
]);
PKG_CONFIG_PATH = pkgs.lib.makeLibraryPath (with pkgs; [
wayland
pkg-config
]);
};
…
}
On this installation, there is a silly little cargo.toml file with the following contents:
[package]
name = “rust-game”
version = “0.1.0”
edition = “2024”[dependencies]
bevy = “0.18”
When we run the console command cargo run the thread panics:
The system library
wayland-clientrequired by cratewayland-syswas not found.
The filewayland-client.pcneeds to be installed and the PKG_CONFIG_PATH environment variable must contain its
parent directory.
The PKG_CONFIG_PATH environment variable is not set.
Running the console command find / -name “wayland-client.pc” I get something like:
/nix/store/sj5qy7qbczvdpz8kbgfyqfn3kj5zppyq-wayland-1.24.0-dev/lib/pkgconfig/wayland-client.pc