Merge #502
502: common/gpu/nvidia*: Migrate to common/gpu/nvidia/* and add non-prime r=Mic92 a=TLATER Co-authored-by: Tristan Daniël Maat <tristan.maat@codethink.co.uk>
This commit is contained in:
commit
0099253ad0
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/cpu/amd/pstate.nix
|
../../../common/cpu/amd/pstate.nix
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
../../../common/pc/ssd
|
../../../common/pc/ssd
|
||||||
../../battery.nix
|
../../battery.nix
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/cpu/amd
|
../../../common/cpu/amd
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
../../../common/pc/ssd
|
../../../common/pc/ssd
|
||||||
];
|
];
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/cpu/amd
|
../../../common/cpu/amd
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
../../../common/pc/ssd
|
../../../common/pc/ssd
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
# This runs only intel/amdgpu igpus and nvidia dgpus do not drain power.
|
imports = [ ./nvidia/disable.nix ];
|
||||||
|
|
||||||
##### disable nvidia, very nice battery life.
|
warnings = [
|
||||||
hardware.nvidiaOptimus.disable = lib.mkDefault true;
|
''
|
||||||
boot.blacklistedKernelModules = lib.mkDefault [ "nouveau" "nvidia" ];
|
DEPRECATED: The <nixos-hardware/common/gpu/nvidia-disable.nix> module has been deprecated.
|
||||||
|
|
||||||
|
Switch to using <nixos-hardware/common/gpu/nvidia/disable.nix> instead.
|
||||||
|
''
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,12 @@
|
||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
# This creates a new 'nvidia-offload' program that runs the application passed to it on the GPU
|
|
||||||
# As per https://nixos.wiki/wiki/Nvidia
|
|
||||||
let
|
|
||||||
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
|
|
||||||
export __NV_PRIME_RENDER_OFFLOAD=1
|
|
||||||
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
|
||||||
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
|
||||||
export __VK_LAYER_NV_optimus=NVIDIA_only
|
|
||||||
exec "$@"
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ];
|
imports = [ ./nvidia/prime.nix ];
|
||||||
environment.systemPackages = [ nvidia-offload ];
|
|
||||||
|
|
||||||
hardware.nvidia.prime = {
|
warnings = [
|
||||||
offload.enable = lib.mkDefault true;
|
''
|
||||||
# Hardware should specify the bus ID for intel/nvidia devices
|
DEPRECATED: The <nixos-hardware/common/gpu/nvidia.nix> module has been deprecated.
|
||||||
};
|
|
||||||
|
|
||||||
hardware.opengl.extraPackages = with pkgs; [
|
Switch to using <nixos-hardware/common/gpu/nvidia/prime.nix> instead if you use prime offloading.
|
||||||
vaapiVdpau
|
If you are using this without prime, consider switching to <nixos-hardware/common/gpu/nvidia> instead.
|
||||||
|
''
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
8
common/gpu/nvidia/default.nix
Normal file
8
common/gpu/nvidia/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ];
|
||||||
|
hardware.opengl.extraPackages = with pkgs; [
|
||||||
|
vaapiVdpau
|
||||||
|
];
|
||||||
|
}
|
9
common/gpu/nvidia/disable.nix
Normal file
9
common/gpu/nvidia/disable.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# This runs only intel/amdgpu igpus and nvidia dgpus do not drain power.
|
||||||
|
|
||||||
|
##### disable nvidia, very nice battery life.
|
||||||
|
hardware.nvidiaOptimus.disable = lib.mkDefault true;
|
||||||
|
boot.blacklistedKernelModules = lib.mkDefault [ "nouveau" "nvidia" ];
|
||||||
|
}
|
22
common/gpu/nvidia/prime.nix
Normal file
22
common/gpu/nvidia/prime.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
# This creates a new 'nvidia-offload' program that runs the application passed to it on the GPU
|
||||||
|
# As per https://nixos.wiki/wiki/Nvidia
|
||||||
|
let
|
||||||
|
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
|
||||||
|
export __NV_PRIME_RENDER_OFFLOAD=1
|
||||||
|
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
||||||
|
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||||||
|
export __VK_LAYER_NV_optimus=NVIDIA_only
|
||||||
|
exec "$@"
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
imports = [ ./. ];
|
||||||
|
|
||||||
|
environment.systemPackages = [ nvidia-offload ];
|
||||||
|
|
||||||
|
hardware.nvidia.prime = {
|
||||||
|
offload.enable = lib.mkDefault true;
|
||||||
|
# Hardware should specify the bus ID for intel/nvidia devices
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/cpu/intel
|
../../../common/cpu/intel
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
../../../common/pc/laptop/ssd
|
../../../common/pc/laptop/ssd
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../default.nix
|
../default.nix
|
||||||
../../../../common/gpu/nvidia.nix
|
../../../../common/gpu/nvidia/prime.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
hardware.nvidia.prime = {
|
hardware.nvidia.prime = {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
../../../common/cpu/intel
|
../../../common/cpu/intel
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
# To just use Intel integrated graphics with Intel's open source driver
|
# To just use Intel integrated graphics with Intel's open source driver
|
||||||
# ../../../common/gpu/nvidia-disable
|
# ../../../common/gpu/nvidia/disable.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# TODO: boot loader
|
# TODO: boot loader
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../default.nix
|
../default.nix
|
||||||
../../../../common/gpu/nvidia.nix
|
../../../../common/gpu/nvidia/prime.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
hardware.nvidia.prime = {
|
hardware.nvidia.prime = {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../../../common/cpu/intel
|
../../../../common/cpu/intel
|
||||||
../../../../common/pc/laptop
|
../../../../common/pc/laptop
|
||||||
../../../../common/gpu/nvidia-disable.nix
|
../../../../common/gpu/nvidia/disable.nix
|
||||||
../xps-common.nix
|
../xps-common.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../../../common/cpu/intel
|
../../../../common/cpu/intel
|
||||||
../../../../common/gpu/nvidia.nix
|
../../../../common/gpu/nvidia/prime.nix
|
||||||
../../../../common/pc/laptop
|
../../../../common/pc/laptop
|
||||||
../xps-common.nix
|
../xps-common.nix
|
||||||
];
|
];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../../../common/cpu/intel
|
../../../../common/cpu/intel
|
||||||
../../../../common/pc/laptop
|
../../../../common/pc/laptop
|
||||||
../../../../common/gpu/nvidia-disable.nix
|
../../../../common/gpu/nvidia/disable.nix
|
||||||
../common.nix
|
../common.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../../../common/cpu/intel
|
../../../../common/cpu/intel
|
||||||
../../../../common/pc/laptop
|
../../../../common/pc/laptop
|
||||||
../../../../common/gpu/nvidia.nix
|
../../../../common/gpu/nvidia/prime.nix
|
||||||
../common.nix
|
../common.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -157,8 +157,9 @@
|
||||||
common-gpu-amd-sea-islands = import ./common/gpu/amd/sea-islands;
|
common-gpu-amd-sea-islands = import ./common/gpu/amd/sea-islands;
|
||||||
common-gpu-amd-southern-islands = import ./common/gpu/amd/southern-islands;
|
common-gpu-amd-southern-islands = import ./common/gpu/amd/southern-islands;
|
||||||
common-gpu-intel = import ./common/gpu/intel.nix;
|
common-gpu-intel = import ./common/gpu/intel.nix;
|
||||||
common-gpu-nvidia = import ./common/gpu/nvidia.nix;
|
common-gpu-nvidia = import ./common/gpu/nvidia/prime.nix;
|
||||||
common-gpu-nvidia-disable = import ./common/gpu/nvidia-disable.nix;
|
common-gpu-nvidia-nonprime = import ./common/gpu/nvidia;
|
||||||
|
common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix;
|
||||||
common-pc = import ./common/pc;
|
common-pc = import ./common/pc;
|
||||||
common-pc-hdd = import ./common/pc/hdd;
|
common-pc-hdd = import ./common/pc/hdd;
|
||||||
common-pc-laptop = import ./common/pc/laptop;
|
common-pc-laptop = import ./common/pc/laptop;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/cpu/amd
|
../../../common/cpu/amd
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
../../../common/pc/laptop/acpi_call.nix
|
../../../common/pc/laptop/acpi_call.nix
|
||||||
../../../common/pc/laptop/ssd
|
../../../common/pc/laptop/ssd
|
||||||
|
|
|
@ -4,7 +4,7 @@ in {
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/cpu/amd
|
../../../common/cpu/amd
|
||||||
../../../common/gpu/amd
|
../../../common/gpu/amd
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
../../../common/pc/laptop/ssd
|
../../../common/pc/laptop/ssd
|
||||||
];
|
];
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/cpu/amd
|
../../../common/cpu/amd
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
../../../common/pc/laptop/ssd
|
../../../common/pc/laptop/ssd
|
||||||
];
|
];
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/cpu/intel
|
../../../common/cpu/intel
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop
|
../../../common/pc/laptop
|
||||||
../../../common/pc/laptop/ssd
|
../../../common/pc/laptop/ssd
|
||||||
];
|
];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../.
|
../.
|
||||||
../../../common/cpu/intel/kaby-lake
|
../../../common/cpu/intel/kaby-lake
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
hardware.nvidia.prime = {
|
hardware.nvidia.prime = {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
../../../common/cpu/intel
|
../../../common/cpu/intel
|
||||||
# might need nvidia module but we don't know the PCI ids:
|
# might need nvidia module but we don't know the PCI ids:
|
||||||
# https://github.com/NixOS/nixos-hardware/pull/274#discussion_r650483740
|
# https://github.com/NixOS/nixos-hardware/pull/274#discussion_r650483740
|
||||||
#../../../common/gpu/nvidia.nix
|
#../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/pc/laptop/acpi_call.nix
|
../../../common/pc/laptop/acpi_call.nix
|
||||||
../../../common/pc/laptop/ssd
|
../../../common/pc/laptop/ssd
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ lib, config, ... }: {
|
{ lib, config, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/cpu/intel
|
../../../common/cpu/intel
|
||||||
../../../common/pc/laptop/acpi_call.nix
|
../../../common/pc/laptop/acpi_call.nix
|
||||||
../.
|
../.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, lib, ... }: {
|
{ config, lib, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/cpu/intel
|
../../../common/cpu/intel
|
||||||
../../../common/cpu/intel/kaby-lake
|
../../../common/cpu/intel/kaby-lake
|
||||||
../../../common/pc/laptop/acpi_call.nix
|
../../../common/pc/laptop/acpi_call.nix
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ lib, config, ... }: {
|
{ lib, config, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
../../../common/gpu/nvidia.nix
|
../../../common/gpu/nvidia/prime.nix
|
||||||
../../../common/cpu/intel
|
../../../common/cpu/intel
|
||||||
../../../common/pc/laptop/acpi_call.nix
|
../../../common/pc/laptop/acpi_call.nix
|
||||||
../.
|
../.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
../../common/pc/laptop/ssd
|
../../common/pc/laptop/ssd
|
||||||
../../common/cpu/intel
|
../../common/cpu/intel
|
||||||
../../common/gpu/nvidia.nix
|
../../common/gpu/nvidia/prime.nix
|
||||||
../../common/pc/laptop
|
../../common/pc/laptop
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../common/cpu/amd
|
../../common/cpu/amd
|
||||||
../../common/gpu/nvidia.nix
|
../../common/gpu/nvidia/prime.nix
|
||||||
../../common/pc/laptop
|
../../common/pc/laptop
|
||||||
../../common/pc/ssd
|
../../common/pc/ssd
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue