Skip to content

High CPU usage when using nixos and wayland + cage #95

Open

Description

@AnderssonPeter

Hi I'm using a build of the program with commit for #89 but when I run flex-launcher in nixos-25.11 it just renders a black screen and consumes a lot of cpu cycles.

It seems to detect when i press keys, so it hasn't locked up totally.
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
Key Right (#4000004F) detected
Key Left (#40000050) detected
Key Right (#4000004F) detected
Key Left (#40000050) detected
Key Right (#4000004F) detected
Key Left (#40000050) detected

@complexlogic do you have any idea what could be wrong?

My nixos config:

# 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;
  console = {
    keyMap = "sv-latin1";
  };

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

  users.extraUsers.htpc.isNormalUser = true;

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

  services.cage = {
    enable = true;
    user = "htpc";
    program = "${pkgs.flex-launcher}/bin/flex-launcher -d";
    #extraArguments = [ "-d" ];
    environment = {
      SDL_VIDEODRIVER = "wayland";
      SDL_VIDEO_DRIVER = "wayland";
    };
  };

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

  hardware = {
    graphics.enable = true;
  };

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

Activity

  1. AnderssonPeter commented on Mar 11, 2026

    @AnderssonPeter
    Author

    @ludocode do you have any idea what could be causing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions