I have tried searching everything related to sway/wayland/wlroots over the internet but couldn’t find anything that fixes my issue. Ir worked fine when I used Arch previously but after switching to NixOS, it just doesn’t start
Sway Error:-
LibEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device.
LibEGL warning: MESA-LOADER: failed to open i915: /run/opengl-driver/lib/dri/1915_dri.so: cannot open shared object file: No such file or directory (searches /run/opengl-driver/lib/dri, suffix dri)
00:00:00.292 [ulr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x30013, nessage: "DRI2: failed to load driver"
00:00:00.292 [ulr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "eglinitialize"
00:00:00.292 [ulr) [render/egl.c:2641 Failed to initialize EGL
00:00:00.292 [ulr] [render/egl.c:5541 Failed to initialize EGL context
00:00:00.292 [wlrl](render/gles2/renderer.c:6791 Could not initialize EGL
00:00:00.293 [wirl frender/ulr_renderer.c:3331 Could not initialize renderer
00:00:00.293 [sway/server.c:791 Failed to create renderer
I have set hardware.opengl.enable = true; in my configuration.nix.
I am using NixOS 23.05
So I feel like from that we are really just trying to make sure that the “i915” module is loading.
boot.initrd.kernelModules = [ “i915” ];
Depending on how you installed NixOS this option might already be set in a hardware-configuration.nix near your configuration.nix file, if you have the option you can just add “i915” to it if it isn’t there already.
If you want the intel gpu options to just be added automatically you’re free to add the nixos-hardware channel following the readme (GitHub - NixOS/nixos-hardware: A collection of NixOS modules covering hardware quirks.), and add <nixos-hardware/common/gpu/intel> to your imports in configuration.nix. Using nixos-hardware isn’t required it’s just a convenience thing.
Thanks to @K900 solution over on Matrix, I was able to solve this issue. For future readers, you need to set the following in your configuration.nix (Override if it already exists) :-