I’ve created this nix-shell for compiling gtk+ programs, and it works as expected
let
pkgs = import <nixpkgs> {};
in
pkgs.mkShell {
buildInputs = with pkgs;[
wayland
cmake
gtk3
gtkmm3
pkg-config
];
}
$ pkg-config --libs --cflags gtk+-3.0
-I/nix/store/36b35s8dq54zasw1ip4833vmwchlij64-gtk+3-3.24.10-dev/include/gtk-3.0 -I/nix/store/2zwaq08fa62w9lxx61f6vbbckabmd1p0-atk-2.32.0-dev/include/atk-1.0 -I/nix/store/lqsxg5vd4hsrvay860nbi9wkv
axsv5qm-glib-2.60.7-dev/include -I/nix/store/lqsxg5vd4hsrvay860nbi9wkvaxsv5qm-glib-2.60.7-dev/include/glib-2.0 -I/nix/store/bwdm2ickbi8d70khf5ibdmgi806sx0zd-glib-2.60.7/lib/glib-2.0/include -I/ni
x/store/xrlf0zqik123skfqdi2hgbd0dbh49pms-cairo-1.16.0-dev/include/cairo -I/nix/store/zs6nj5f5vszhpnzqqbcs3hx4phd23m3w-freetype-2.10.1-dev/include/freetype2 -I/nix/store/zs6nj5f5vszhpnzqqbcs3hx4ph
d23m3w-freetype-2.10.1-dev/include -I/nix/store/8c6p24qq6fd01bpy7xs4dd1gspgks05q-gdk-pixbuf-2.38.1-dev/include/gdk-pixbuf-2.0 -I/nix/store/870azfhlxdiid45xs9myp9mzj4pa9wc9-pango-1.43.0-dev/includ
e/pango-1.0 -L/nix/store/j77kdavzzjai85398bgkw03h7qryx17g-gtk+3-3.24.10/lib -L/nix/store/01fpjv73z3rpf6q0bjvz4w5n7kh0vb0d-atk-2.32.0/lib -L/nix/store/bwdm2ickbi8d70khf5ibdmgi806sx0zd-glib-2.60.7/
lib -L/nix/store/852bv959f980d58n3c7kb8afd509nh4i-cairo-1.16.0/lib -L/nix/store/kh536yb4f8q0vjp8h3rfd4gk2ff77nj3-gdk-pixbuf-2.38.1/lib -L/nix/store/4zqxhvz5ripix2c88clqmq22jvq7sdzd-pango-1.43.0/l
ib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
$
But for some reason pkg-config
fails to find gtk+ in an fhsuserenv with the same packages:
let
pkgs = import <nixpkgs> {};
in
(pkgs.buildFHSUserEnv {
name = "t";
targetPkgs = pkgs: (with pkgs;[
wayland
gtk3
gtkmm3
cmake
pkg-config
]);
runScript = "zsh";
}).env
pkg-config
is unable to find gtk+ inside this user environment:
$ pkg-config --libs --cflags gtk+-3.0
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
It can, however, find other packages (wayland):
$ pkg-config --libs --cflags wayland-client
-I/nix/store/zs6fyy5s7yh0pvjh0dxb6ii3dxx8xbl7-wayland-1.17.0/include -L/nix/store/zs6fyy5s7yh0pvjh0dxb6ii3dxx8xbl7-wayland-1.17.0/lib -lwayland-client
$
What is the issue here?