C; SDL3 No available video device on NixOS despite showing up as having drivers

I’m trying to get a window running on NixOS with my compositor set as wayland, but whenever I try to initialize SDL I get this issue

SDL_Init failed: No available video device

and when I checked the rendering drivers I ended up with this

drivers:
  wayland
  x11
  offscreen
  dummy
  evdev
current: (null)

does anyone know how to fix it, this is a minimum reproducible example of the code, the code works on MacOS as confirmed by a person I’m working with

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <SDL3/SDL.h>

struct {
    SDL_Window* sdl_window;
} AppState;

int main() {
    printf("initializing sdl %d.%d.%d\n",
       SDL_MAJOR_VERSION,
       SDL_MINOR_VERSION,
       SDL_MICRO_VERSION);
    if(!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO |SDL_INIT_EVENTS | SDL_INIT_GAMEPAD)){
        printf("{Error 0001} SDL_Init failed: %s\n", SDL_GetError());
        return EXIT_FAILURE;
    }
 
    int width = 640;
    int height = 360;
 
	int flags = 0;
    flags |= SDL_WINDOW_HIGH_PIXEL_DENSITY;
 
    AppState.sdl_window = SDL_CreateWindow("mei-hua!", width, height, flags);
    if(AppState.sdl_window == NULL) {
        printf("{Error 0002} SDL Window is null");
        return EXIT_FAILURE;
    }
    SDL_ShowWindow(AppState.sdl_window);
 
    return EXIT_SUCCESS;
}

and this is my flake.nix

{
  description = "mei hua game engine dev environment";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; };
      in
      {

        apps.default = {
          type = "app";
          program = "${pkgs.godot-mono}/bin/godot-mono";
        };

        devShells.default = pkgs.mkShell {
          packages = with pkgs; [
                llvmPackages.clang
                llvmPackages.clang-tools
                vscodium
                cmake
                pkg-config

                glibc

                # X11
                libX11
                libXext
                libXrandr
                libXcursor
                libXi
                libXfixes
                libxscrnsaver
                libxtst
                libxcb

                SDL3

                # Wayland
                wayland
                wayland.dev
                wayland-protocols
                wayland-scanner
                alsa-lib
                pipewire
                libdecor
                libxkbcommon
                dbus
                udev
                egl-wayland
                waylandpp
                wayland-protocols
                xwayland
                libGL
                libffi

                libxkbcommon
                libdecor         

                mesa
                pipewire

          ];
        };
      }
    );
}

There is no SDL3 package in nixpkgs, only sdl3 so I don’t know how your flake works.

I can’t reproduce your problem with the provided program, SDL initializes successfully. Try export SDL_LOGGING="*=trace" before running your program to get more info on why it fails.