How to install gbm for compilation

So my nixos uses wayland and hence I use swaywm, so I wanted to compile wlroots for myself, but when I try to compile it, I get this error

meson.build:100:0: ERROR: Dependency "gbm" not found, tried pkgconfig and cmake

this is my shell.nix

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
	nativeBuildInputs = with pkgs; [ pkgconfig meson ninja cmake ];
	buildInputs = with pkgs; [
		pixman
		udev
		egl-wayland
		libdrm
		wayland
		wayland-scanner
		wayland-protocols
		libxkbcommon
		wlroots
	];
}

So I tried to search on how to install gbm, but found no solutions, How do I resolve this dependency?

To directly answer your question: gbm is included in mesa.

However, an easier way to write your shell is simply

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
  inputsFrom = [ pkgs.wlroots ];
}

And an even easier method, if you are using the experimental nix CLI, is nix develop nixpkgs#wlroots instead of nix shell.

1 Like