mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Hardware/Nvidia] Add better NVidia GPU support, including proprietary drivers
This commit is contained in:
parent
cab07f3d14
commit
37ff0a5320
4 changed files with 58 additions and 2 deletions
|
|
@ -4,7 +4,38 @@ let
|
|||
hardwareCfg = config.aviallon.hardware;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./nvidia
|
||||
];
|
||||
|
||||
options.aviallon.hardware.useProprietary = mkEnableOption "nvidia proprietary drivers";
|
||||
|
||||
config = mkIf (hardwareCfg.gpuVendor == "nvidia") {
|
||||
boot.initrd.kernelModules = [ "nouveau" ];
|
||||
boot.initrd.kernelModules = if hardwareCfg.useProprietary then [
|
||||
"nvidia"
|
||||
"nvidia_drm"
|
||||
"nvidia_uvm"
|
||||
"nvidia_modeset"
|
||||
] else [ "nouveau" ];
|
||||
# boot.blacklistedKernelModules = optional hardwareCfg.useProprietary "nouveau";
|
||||
services.xserver.videoDrivers = optional hardwareCfg.useProprietary "nvidia";
|
||||
hardware.opengl.driSupport32Bit = true;
|
||||
hardware.nvidia = {
|
||||
powerManagement.enable = true;
|
||||
modesetting.enable = true;
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfreePredicate = mkIf (hardwareCfg.useProprietary) (pkg: builtins.elem (lib.getName pkg) [
|
||||
"nvidia-x11"
|
||||
]);
|
||||
|
||||
hardware.opengl.extraPackages = with pkgs; [
|
||||
libvdpau-va-gl
|
||||
vaapiVdpau
|
||||
];
|
||||
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||
libvdpau-va-gl
|
||||
vaapiVdpau
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
6
hardware/nvidia/default.nix
Normal file
6
hardware/nvidia/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{config, ...}:
|
||||
{
|
||||
imports = [
|
||||
./vgpu.nix
|
||||
];
|
||||
}
|
||||
19
hardware/nvidia/vgpu.nix
Normal file
19
hardware/nvidia/vgpu.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{config, pkgs, lib, ...}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.aviallon.hardware;
|
||||
useVgpu = (cfg.useProprietary &&
|
||||
(cfg.gpuVendor == "nvidia") &&
|
||||
(versionOlder config.boot.kernelPackages.kernel.version "5.10"));
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
<nixos-nvidia-vgpu>
|
||||
# (optional useVgpu (builtins.fetchTarball "https://github.com/danielfullmer/nixos-nvidia-vgpu/archive/master.tar.gz"))
|
||||
];
|
||||
|
||||
config = mkIf useVgpu {
|
||||
hardware.nvidia.vgpu.enable = true; # Enable NVIDIA KVM vGPU + GRID driver
|
||||
hardware.nvidia.vgpu.unlock.enable = true; # Unlock vGPU functionality on consumer cards using DualCoder/vgpu_unlock project.
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue