numtide / nixos-facter-modules

A series of NixOS modules to be used in conjunction with https://github.com/numtide/nixos-facter [maintainer=@numtide]
https://numtide.github.io/nixos-facter-modules/
MIT License
63 stars 5 forks source link

Set up Intel/Nvidia/AMD gpus #40

Open Mic92 opened 2 months ago

Mic92 commented 2 months ago

We already load gpu drivers into the initrd, but we do not yet setup opengl/vulkan drivers.

Mic92 commented 2 months ago

For nvidia we can detect the gpu chip generation and than decide if want the open or closed gpu driver.

We figured out that lspci has the gpu generation for nvidia in its first few characters encoded.

geekodour commented 1 month ago

I am getting the following with nixos-anywhere and facter:

error:
       … while calling the 'seq' builtin

         at /nix/store/m1szqwijms610n6325mwjswslha4nd92-source/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       … while calling the 'throw' builtin

         at /nix/store/m1szqwijms610n6325mwjswslha4nd92-source/lib/modules.nix:298:18:

          297|                     ''
          298|             else throw baseMsg
             |                  ^
          299|         else null;

       error: The option `hardware.graphics' does not exist. Definition values:
       - In `/nix/store/isph9via2616d4hf2ixavza3ig9wjk2c-source/modules/nixos/graphics.nix':
           {
             _type = "if";
             condition = true;
             content = {
               enable = {
           ...

is it related?

I am trying to deploy a hetzner vm, where I don't really care about graphics here. So unsure about this usecase

Mic92 commented 1 month ago

@geekodour This option was introduced in nixpkgs-unstable but is not yet available in 24.05. Fix in https://github.com/numtide/nixos-facter-modules/pull/45 We currently don't actively test nixos 24.05 compatibility, but we might start doing this with 24.11.

Mic92 commented 2 weeks ago

We have now some support for AMD GPUs. For nvidia, we need to detect the gpu generation to figure out if we can use the open driver or not. For Intel we need to detect the iGPU generation as well to load the right opencl/opengl and vaapi driver.