added system to dirs
This commit is contained in:
37
modules/system/nvidia/default.nix
Normal file
37
modules/system/nvidia/default.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.system.nvidia;
|
||||
in
|
||||
{
|
||||
options.system.nvidia = {
|
||||
enable = lib.mkEnableOption "enables nvidia";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
boot.kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
|
||||
# boot.kernelModules = [ "nvidia" ];
|
||||
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
# enable nvidia proprietary driver
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true; # required
|
||||
open = false; # use proprietary driver
|
||||
nvidiaSettings = true; # no shit
|
||||
powerManagement.enable = false; # can cause sleep issues
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
};
|
||||
|
||||
# enable docker gpu passthrough
|
||||
hardware.nvidia-container-toolkit.enable = true;
|
||||
virtualisation.docker.daemon.settings.features.cdi = true;
|
||||
virtualisation.docker.rootless.daemon.settings.features.cdi = true;
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user