Glxgears with 40 FPS on AMD laptop


I recently set up NixOs on my new Thinkpad L14 and it feels sluggish.

CPU is a Ryzen Pro 7 5875U (8C/16T) with an AMD Radeon integrated. This is a new laptop, performance shouldn’t be an issue for everyday tasks.

But I get ~40 FPS on glxgears. I also see/feel some lags in other apps, like high latency between typing and seeing the letters in chromium; slow mouse movement in OrcaSlicer; and some other places. Firefox runs great though.

I run glxgears with nvtop open and I see up to 1% GPU usage by it. Somehow the performance is poor but the hardware is available to do more?

I don’t even know where to start troubleshooting.

The full config for my systems is in my dotfiles GitHub repo. And the part related to my laptop’s hardware is this:

  boot.initrd.kernelModules = [ "amdgpu" ];
  boot.kernelParams = [


    # Load amdgpu at stage 1


  hardware.opengl.extraPackages = with pkgs; [

    # AMD ROCm OpenCL runtime

  hardware.opengl.extraPackages32 = with pkgs; [

  environment.variables = {
    # VAAPI and VDPAU config for accelerated video.
    # See
    "VDPAU_DRIVER" = "radeonsi";
    "LIBVA_DRIVER_NAME" = "radeonsi";
  # Most software has the HIP libraries hard-coded. Workaround:
  systemd.tmpfiles.rules = [
    "L+    /opt/rocm/hip   -    -    -     -    ${pkgs.rocmPackages.clr}"

  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;

How can I get decent performance out of this laptop with NixOs? I’m lost here :confused: What am I missing?