2

I made a clean installation of NixOS without X11.

Then I ran

nix-env -i wayland
nix-env -i sway
nix-env -i glu
nix-env -i mesa-noglu
reboot
sway

Yet I receive follwing error

gbm: failed to open any drive (search paths /run/opengl-driver/lib/dri)
gbm: Last dlopen error: /run/opengl-driver/lib/dri/i965_dri.so: open shared object file: No such file or directory
failed to load driver: i965
gbm: failed to open any drive (search paths /run/opengl-driver/lib/dri)
gbm: Last dlopen error: /run/opengl-driver/lib/dri/kms_swrast_dri.so: open shared object file: No such file or directory
failed to load driver: kms_swrast
gbm: failed to open any drive (search paths /run/opengl-driver/lib/dri)
gbm: Last dlopen error: /run/opengl-driver/lib/dri/swrast_dri.so: open shared object file: No such file or directory
failed to load driver: wrast

[wlc] Failed to init compositor

In other words I am missing some opengl drivers, but how am I supposed to get them?

  • 1
    Not sure about wayland or sway but for OpenGL support you may need to enable hardware.opengl.enable and hardware.opengl.driSupport options in your configuration.nix. Would seem to work for me when tested in a VM without xserver enabled. – ppb Aug 11 '17 at 16:40
2

When you're dealing with services on NixOS, such as Xorg, wayland, etc, they will not work when installed from nix-env. Instead, you need to enable and configure them in /etc/nixos/configuration.nix.

When you're not sure how to configure a service the best place to start is with the NixOS manual.

After that, use the options page to get more detailed information about configuration options. For example, if you search for opengl you'll see various options you can configure.

Unfortunately, as far as I know wayland is not available as a service on NixOS. So you may have tough time getting it to work.

Typically, a service which depends on packages will have a option where you can specify what that package should be. For example, the fontconfig NixOS module has the option fonts.fonts which can be set to a list of font packages. This allows the fontconfig module to set up the fonts correctly. A similar strategy can be used with a Wayland module, whenever that is written.

  • That's because Wayland is not a service like Xorg. It doesn't require a daemon, it's a library. – noun Aug 13 '18 at 11:51
2

As mentioned, installing stuff (like mesa) won't change some system properties. In this particular case, the necessary /run/opengl-driver* symlinks are set up on NixOS when starting the display-manager service.

2

I am running NixOS with Sway and without X11. I managed to recreate your error by commenting out this line in my configuration.nix:

hardware.opengl.enable = true;

When I reinstated the line Sway worked as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.