Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION]: How can I install nvidia driver on Athena Nix #9

Open
DDrozdzz-1066 opened this issue Jun 16, 2024 · 16 comments
Open

[QUESTION]: How can I install nvidia driver on Athena Nix #9

DDrozdzz-1066 opened this issue Jun 16, 2024 · 16 comments
Labels
question Further information is requested

Comments

@DDrozdzz-1066
Copy link

No description provided.

@DDrozdzz-1066 DDrozdzz-1066 added the question Further information is requested label Jun 16, 2024
@AkechiShiro
Copy link
Contributor

It is the same as installing the driver under NixOS, follow the instruction here : https://nixos.wiki/wiki/Nvidia

@AkechiShiro
Copy link
Contributor

@D3vil0p3r TBC

@DerDennisOP
Copy link
Contributor

I have a module laying around we can add this somewhere:

{ config, pkgs, lib, ... }: let
  datacenterEnabled = config.hardware.nvidia.datacenter.enable;
in {
  options = {
    hardware.nvidia.rtx = lib.mkEnableOption "Enable NVIDIA RTX support";
  };

  config = lib.mkIf config.hardware.nvidia.rtx {
    programs.atop.atopgpu.enable = true;
    services.xserver.videoDrivers = lib.optional (!datacenterEnabled) "nvidia";
    environment.systemPackages = with pkgs; [
      nvitop
      cudaPackages.cudnn
      cudatoolkit
    ];

    boot = {
      extraModulePackages = [ config.hardware.nvidia.package ];
      initrd.kernelModules = lib.optionals (!datacenterEnabled) [
        "nvidia"
        "nvidia_modeset"
        "nvidia_drm"
        "nvidia_uvm"
      ];
    };

    hardware = {
      graphics.enable = !datacenterEnabled;
      nvidia = {
        open = false;
        nvidiaPersistenced = true;
        prime.offload.enable = datacenterEnabled;
        powerManagement.enable = datacenterEnabled;
        powerManagement.finegrained = datacenterEnabled;
        package = let
          driver = config.boot.kernelPackages.nvidiaPackages;
        in
          if datacenterEnabled then driver.dc_535 else driver.beta;
      };
    };
  };
}

@D3vil0p3r
Copy link
Member

It should be managed at install level. Athena installer has several ways to recon your GPU. I should check if the autogpu driver install was implemented or not

@D3vil0p3r
Copy link
Member

@DerDennisOP can you implement Nvidia and AMDGpu modules in Athena Nix but by setting them as false? So the installer will switch them to true if one of those gpu is detected?

@DerDennisOP
Copy link
Contributor

DerDennisOP commented Sep 28, 2024

tbh I have no idea about the installer, but we can add some nvidia hardware module and turn it on when needed. Whatever you decide. I havn't had problems with amd gpus yet, since setting them up is as simple as that:

hardware.graphics = {
 enable = true;
 enable32Bit = true;
};

@AkechiShiro
Copy link
Contributor

Is a module really needed, doesn't nixos-generate-config already detects hardware and generates proper configuration ? Also using : https://github.com/NixOS/nixos-hardware

@DerDennisOP
Copy link
Contributor

Is a module really needed, doesn't nixos-generate-config already detects hardware and generates proper configuration ? Also using : https://github.com/NixOS/nixos-hardware

no thats not the case

@AkechiShiro
Copy link
Contributor

AkechiShiro commented Sep 28, 2024

Are you sure it's a good idea to introduce a new module ?

I can't help but wonder why all these are for :
image

We won't be able to detect drivers breaking on platforms better than what is already in nixos-hardware especially on MacOS platforms.

I believe we shouldn't reinvent the wheel to use iGPU and dGPU but just my 2cent, I'm pretty sure most hardware quirks for specific platform needs to go upstream and should not be handled by the installer directly.

@AkechiShiro
Copy link
Contributor

Btw here are the module you're looking to write I think : https://github.com/NixOS/nixos-hardware/blob/d830ad47cc992b4a46b342bbc79694cbd0e980b2/common/gpu/

@AkechiShiro
Copy link
Contributor

IMHO, here is what we should try and auto detect, to import profiles for hardware quirks during install :

If you want to work on it let me know @DerDennisOP I maybe able to help

@DerDennisOP
Copy link
Contributor

Is a module really needed, doesn't nixos-generate-config already detects hardware and generates proper configuration ? Also using : https://github.com/NixOS/nixos-hardware

no thats not the case

Are you sure you're familiar with Nix ?

I can't help but wonder why all these are for : image

We won't be able to detect drivers breaking on platforms better than what is already in nixos-hardware especially on MacOS platforms.

I believe we shouldn't reinvent the wheel to use iGPU and dGPU but just my 2cent, I'm pretty sure most hardware quirks for specific platform needs to go upstream and should not be handled by the installer directly.

we cant use nixos-hardware since it has servers and desktops that are common builds there wont be every user specific configuration there. we might be able to take a module from there. But since I'm not familiar with this I'm sure you can handle it alone better ;)

@AkechiShiro
Copy link
Contributor

AkechiShiro commented Sep 28, 2024

I still don't understand your comment, I'm sorry if I miss anything but profiles are specific to hardware platforms, common modules are only defined so options can be toggled on/off, see for instance these framework laptops profiles :

I don't see any Framework servers yet, if you happen to see any let me know

User configuration should be left to users, if they want to run bleeding edge Nvidia drivers, they could override the profile.

@D3vil0p3r
Copy link
Member

D3vil0p3r commented Sep 28, 2024

Are you sure you're familiar with Nix ?

@AkechiShiro thank you for reviewing your comment. @DerDennisOP what is your proposal? The installer practically detects the GPU model implemented on the system and my idea was to switch to true Nvidia or AMD nix attributes.

@DerDennisOP
Copy link
Contributor

@D3vil0p3r I would say adding a module enabling all the options needed options for Nvidia and AMD. After that we can just enable it by setting e.g. a "gpu" value to "nvidia" or "amd"

@D3vil0p3r
Copy link
Member

@D3vil0p3r I would say adding a module enabling all the options needed options for Nvidia and AMD. After that we can just enable it by setting e.g. a "gpu" value to "nvidia" or "amd"

Yes. It can be also changed automatically by Aegis installer once implemented. Im trying to make cyber-toolnix as a module instead of a Rust program.

@D3vil0p3r D3vil0p3r reopened this Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants