Firefox memory leak | firefox bad performance on intel integrated graphics

I recently installed nixos on an off-brand laptop from a local manufacturer. Whenever I opened firefox I would start noticing a huge performance drop, as well as memory ramping up (even after killing firefox) until I had to hit the power button as the system deemed unusable. I also noticed a few posts from reddit and nixpkgs github’s issues but none of them seemed to solve the problem

After looking for a while, I found out that firefox was trying to use VAAPI, which was not available in my system.

[GFX1-]: vaapitest: VA-API test failed: failed to initialise VAAPI connection.

Just add the following lines to your configuration.nix

  hardware.opengl.extraPackages = with pkgs; [                                                                                                                              
    vaapiIntel                                                                                                                                                              
    libvdpau-va-gl                                                                                                                                                          
    intel-media-driver                                                                                                                                                      
  ];

I’m unaware if this is an nixos specific issue

You may want to try out some nixos-hardware modules, the intel module does this by default, and the CPU ones set some important kernel args: https://github.com/NixOS/nixos-hardware/blob/7763c6fd1f299cb9361ff2abf755ed9619ef01d6/common/gpu/intel/default.nix

If there’s no module for your device, the various common modules are quite usable as-is - and you could get started on actually making a module based on those if you have some time.

Edit: Huh, how did I end up on a 2 month old post…

3 Likes