NixOS / nixos-hardware

A collection of NixOS modules covering hardware quirks.
Creative Commons Zero v1.0 Universal
2.08k stars 641 forks source link

Allow increasing `gpu_mem` for Raspberry PI #1142

Open M-Gregoire opened 2 months ago

M-Gregoire commented 2 months ago

Hello :wave: ,

After installing NixOS and using nixos-hardware to setup my Raspberry Pi 4, the allocated GPU memory is 76M.

# vcgencmd get_mem gpu
gpu=76M

I'd like to increase it to at least 128M. I believe the standard way would have been:

  boot.loader.raspberryPi = {
    enable = true;
    firmwareConfig = ''
      gpu_mem=128
    '';
  };

But I've read in an other issue that firmwareConfig is gonna be deprecated.

I'm not quite sure what it the proper way to increase the memory allocation for the GPU.

Any help would be appreciated :)

Mic92 commented 2 months ago

Not sure if this can be actually deprecated because I assume that the bootloader won't respect dts. At least this is my understanding. So firmwareConfig is probably still the way to go?

M-Gregoire commented 1 month ago

Thank you for your answer.

I've tried the snippet above which produced the following error :

Failed assertions:
       - Only Raspberry Pi >= 3 supports aarch64.

(Coming from here) when the target is a Raspberry pi 4 with nixos-hardware.nixosModules.raspberry-pi-4 in it's flake.

So, upon further inspection, it seems that It might be because firmwareConfig requires loader.raspberryPi (Here) where nixos-hardware defaults to the generic one (here).

Documentation for loader.raspberryPi.enable states:

Whether to create files with the system generations in /boot. /boot/old will hold files from old generations.

These options are deprecated, unsupported, and may not work like expected.

So it does feel like this might be not the right way to go with this, but again, I'm not quite sure how to change the gpu_mem otherwise.

Would you have any advice by any chance?

Mic92 commented 1 month ago

You may need to set the version to 4 as well to avoid the evaluation error that you see.