Sdl application broken after upgrading from 25.05 to 25.11

Hi I have a HTPC where I use NixOS and as my start interface i use flex-launcher that is built using SDL2.

I start it using wayland and cage and I have created a minimal config to reproduce the issue (I have used a hyper-v vm to reproduce the issue, but the same or a similar issue happens on real hardware)

# Base minimum configuration to get started
{ config, lib, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
    ];
  virtualisation.hypervGuest.enable = true;
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  networking.networkmanager.enable = true;

  users = {
    users = {
      htpc = {
        uid = 1001;
        isNormalUser = true;
        extraGroups = [
          "input"
          "dialout"
          "video"
          "render"
          "audio"
        ];
        group = "htpc";
        packages =  with pkgs; [
          xterm
          flex-launcher
        ];
      };
    };
    groups.htpc = {
      gid = 1001;
    };
  };

  users.extraUsers.htpc.isNormalUser = true;
  services.cage = {
    enable = true;
    user = "htpc";
    program = "${pkgs.flex-launcher}/bin/flex-launcher -d";
    extraArguments = [ "-d" ];
  };

  services.openssh = {
    enable = true;
    settings = {
      PasswordAuthentication = true;
      AllowUsers = null;
      PermitRootLogin = "yes";
    };
  };

  hardware = {
    graphics.enable = true;
    #alsa.enable = true;
  };

  system.stateVersion = "25.05"; # Do not change this value you fool!
}

After upgrading to 25.11 I’m only met with a black screen with nothing on it..

If I instead force nixos to use the latest commit of flex-launcher (plus som additional logging i added my self) with the following

  # Force flex-launcher to use a fork with improved logging (also contains fixes for sdl that aren't in any release yet)
  nixpkgs.overlays = [
    (final: prev: {
      # nix-shell -p nix-prefetch-github
      # nix-prefetch-github --nix AnderssonPeter flex-launcher
      flex-launcher = prev.flex-launcher.overrideAttrs (old: {
        src = prev.fetchFromGitHub {
          owner = "AnderssonPeter";
          repo = "flex-launcher";
          rev = "b2640e734c70853e2e8c27ce7c2ff550f79102e5";
          hash = "sha256-SnkWM5xPA0YSBXWmSEM5OV+RCJp3ustpwg422dth88o=";
        };
      });
    })
  ];

The flex-launcher application just craches on 25.11 (but the application still works on 25.05 with the newer version of flex-launcher)

The application logs the following when crashing:

Flex Launcher version 2.2, using:
  SDL       2.32.60
  SDL_image 2.8.8
  SDL_ttf   2.24.0

Build date: Jan  1 1980
Compiler:   GCC 14.3

Config file found: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/config.ini
Initializing SDL
Initializing SDL_image
Initializing SDL_ttf
Validating settings...
Highlight padding value 25 too large to fit screen, shrinking to 0
Icon spacing value 51 too large to fit screen, shrinking to 0
Initializing SVG rasterizer
Creating SDL Window and Renderer
Hiding mouse cursor
Creating SDL Renderer

So it crashes on the following line: flex-launcher/src/launcher.c at b2640e734c70853e2e8c27ce7c2ff550f79102e5 · AnderssonPeter/flex-launcher · GitHub

And the systemd cage log says the following

Mar 10 19:31:17 nixos systemd[1]: Started cage-tty1.service.
Mar 10 19:31:17 nixos (cage)[3572]: pam_unix(cage:session): session opened for user htpc(uid=1001) by htpc(uid=0)
Mar 10 19:31:18 nixos systemd[1]: cage-tty1.service: Main process exited, code=dumped, status=6/ABRT
Mar 10 19:31:18 nixos systemd[1]: cage-tty1.service: Failed with result 'core-dump'.

From checking the log of flex-launcher on 25.05 I can see that sdl seems to use a x11 video driver.

So I managed to force it to use wayland by setting the env variables SDL_VIDEODRIVER and SDL_VIDEO_DRIVE to ”wayland” while the application no longer crashes it just displays a black screen.

the flex-launcher log can be found under /home/htpc/.local/share/flex-launcher/flex-launcher.log and when it starts up and displays a black screen i get the following log

Flex Launcher version 2.2, using:
  SDL       2.32.60
  SDL_image 2.8.8
  SDL_ttf   2.24.0

Build date: Jan  1 1980
Compiler:   GCC 14.3

Config file found: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/config.ini
Initializing SDL
Initializing SDL_image
Initializing SDL_ttf
Validating settings...
Highlight padding value 25 too large to fit screen, shrinking to 0
Icon spacing value 51 too large to fit screen, shrinking to 0
Initializing SVG rasterizer
Creating SDL Window and Renderer
Hiding mouse cursor
Creating SDL Renderer
Setting renderer blend mode to blend
Setting renderer draw color
================== Video Information ===================

Resolution:    1024x768
Refresh rate:  60 Hz
Video driver:  wayland

Supported Texture formats:
  SDL_PIXELFORMAT_ARGB8888
  SDL_PIXELFORMAT_ABGR8888
  SDL_PIXELFORMAT_RGB888
  SDL_PIXELFORMAT_BGR888
  SDL_PIXELFORMAT_YV12
  SDL_PIXELFORMAT_IYUV
  SDL_PIXELFORMAT_NV12
  SDL_PIXELFORMAT_NV21

======================= General ========================

DefaultMenu:              Main
VSync:                    true
FPSLimit:                 -1
ApplicationTimeout:       15
OnLaunch:                 Blank
WrapEntries:              false
ResetOnBack:              false
MouseSelect:              false
InhibitOSScreensaver:     true
StartupCmd:               (null)
QuitCmd:                  (null)

===================== Background =======================

Mode:                     Color
Color:                    #000000FF
Image:                    (null)
SlideshowDirectory:       (null)
SlideshowImageDuration:   30
SlideshowTransitionTime:  1.50
Overlay:                  false
OverlayColor:             #0000007F

======================= Layout =========================

MaxButtons:               4
IconSize:                 256
IconSpacing:              0
VCenter:                  50%

======================== Titles ========================

Enabled:                  true
Font:                     /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/fonts/OpenSans-Regular.ttf
FontSize:                 36
Color:                    #FFFFFFFF
Shadows:                  false
ShadowColor:              #000000FF
OversizeMode:             Shrink
Padding:                  20

====================== Highlight =======================

FillColor:                #FFFFFF3F
OutlineSize:              0
OutlineColor:             #0000FFFF
CornerRadius:             0
VPadding:                 30
HPadding:                 0

================== Scroll Indicators ===================

Enabled:                  true
FillColor:                #FFFFFFFF
OutlineSize:              0
OutlineColor:             #000000FF

======================== Clock =========================

Enabled:                  false
ShowDate:                 false
Alignment:                Left
Font:                     /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/fonts/SourceSansPro-Regular.ttf
FontSize:                 50
Margin:                   38
FontColor:                #FFFFFFFF
Shadows:                  false
ShadowColor:              #000000FF
TimeFormat:               Auto
DateFormat:               Auto
IncludeWeekday:           true

===================== Screensaver ======================

Enabled:                  false
IdleTime:                 300
Intensity:                70%
PauseSlideshow:           true

======================= Gamepad ========================

Enabled:                  false
DeviceIndex:              -1
ControllerMappingsFile:   (null)
LStickX-                  :left
LStickX+                  :right
ButtonA                   :select
ButtonB                   :back
ButtonDPadLeft            :left
ButtonDPadRight           :right

======================== Hotkeys =========================

Hotkey 0 Keycode: 1B
Hotkey 0 Command: :quit

======================= Menu Entries =======================

Menu Name: Main
Number of Entries: 4
Entry 0 Title: Kodi
Entry 0 Icon Path: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/icons/kodi.png
Entry 0 Command: /usr/share/applications/kodi.desktop

Entry 1 Title: Plex
Entry 1 Icon Path: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/icons/plex.png
Entry 1 Command: /usr/share/applications/plexmediaplayer.desktop;TVF

Entry 2 Title: Steam
Entry 2 Icon Path: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/icons/steam.png
Entry 2 Command: /usr/share/applications/steam.desktop;BigPicture

Entry 3 Title: System
Entry 3 Icon Path: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/icons/system.png
Entry 3 Command: :submenu System
----------------------------------------------------------
Menu Name: System
Number of Entries: 3
Entry 0 Title: Shutdown
Entry 0 Icon Path: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/icons/system.png
Entry 0 Command: :shutdown

Entry 1 Title: Restart
Entry 1 Icon Path: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/icons/restart.png
Entry 1 Command: :restart

Entry 2 Title: Sleep
Entry 2 Icon Path: /nix/store/pvh35nfa77xpcj946szn66lfkmp3730y-flex-launcher-2.2/share/flex-launcher/assets/icons/sleep.png
Entry 2 Command: :sleep

Loading menu 'Main'
Begin program loop
Gained keyboard focus
Key Numlock (#40000053) detected
Key Numlock (#40000053) detected

I’m no C developer or Linux expert so I’m a bit lost on how to debug the issue further, does anyone have a idea what could be the issue or how to solve it?

At the moment my only idea is to switch to x11, but that would mean I would have to setup a number of application all again (With som luck they just work on x11 but who knows).

It appears to be an issue with cage 0.2.1, and not isolated to just flex-launcher, here’s an issue raised with Kodi Kodi black screen with 73bf1c8 · Issue #469 · cage-kiosk/cage · GitHub . They mention in that issue that it works with 0.2.0.

If you’re using flakes, you could do what I’ve done. Add this into your inputs, which is just referencing an older nixpkgs commit when cage was still 0.2.0.

"nixpkgs-cage-0.2.0".url = "github:NixOS/nixpkgs/aa725fdeba9963ed389ff641aaf6209988adda7d";

And then you can add cage to your overlays.

  nixpkgs.overlays = [
    (final: prev: {
      cage = inputs."nixpkgs-cage-0.2.0".legacyPackages.${prev.stdenv.hostPlatform.system}.cage;

      # and your flex-launcher overlay if you want.
    })
  ];