From 88870ad106690c2796cefc01803aba6ebc966ecc Mon Sep 17 00:00:00 2001 From: Bradley Nelson Date: Sat, 31 Aug 2024 16:40:11 -0600 Subject: [PATCH 1/5] feat: Add configurations for nvidia microarchitectures with configs for the open source drivers --- common/gpu/nvidia/ada-lovelace/default.nix | 10 ++++++++++ common/gpu/nvidia/ampere/default.nix | 10 ++++++++++ common/gpu/nvidia/maxwell/default.nix | 7 +++++++ common/gpu/nvidia/pascal/default.nix | 7 +++++++ common/gpu/nvidia/turing/default.nix | 10 ++++++++++ flake.nix | 5 +++++ 6 files changed, 49 insertions(+) create mode 100644 common/gpu/nvidia/ada-lovelace/default.nix create mode 100644 common/gpu/nvidia/ampere/default.nix create mode 100644 common/gpu/nvidia/maxwell/default.nix create mode 100644 common/gpu/nvidia/pascal/default.nix create mode 100644 common/gpu/nvidia/turing/default.nix diff --git a/common/gpu/nvidia/ada-lovelace/default.nix b/common/gpu/nvidia/ada-lovelace/default.nix new file mode 100644 index 000000000..9a0657692 --- /dev/null +++ b/common/gpu/nvidia/ada-lovelace/default.nix @@ -0,0 +1,10 @@ +{lib, config, ...}: +let + nividiaPackage = config.hardware.nvidia.package; +in +{ + imports = [ ../. ]; + + # enable the opensorce drivers if the package supports it + hardware.nvidia.open = lib.mkDefault (nividiaPackage ? open && nividiaPackage ? firmware); +} diff --git a/common/gpu/nvidia/ampere/default.nix b/common/gpu/nvidia/ampere/default.nix new file mode 100644 index 000000000..9a0657692 --- /dev/null +++ b/common/gpu/nvidia/ampere/default.nix @@ -0,0 +1,10 @@ +{lib, config, ...}: +let + nividiaPackage = config.hardware.nvidia.package; +in +{ + imports = [ ../. ]; + + # enable the opensorce drivers if the package supports it + hardware.nvidia.open = lib.mkDefault (nividiaPackage ? open && nividiaPackage ? firmware); +} diff --git a/common/gpu/nvidia/maxwell/default.nix b/common/gpu/nvidia/maxwell/default.nix new file mode 100644 index 000000000..89565090f --- /dev/null +++ b/common/gpu/nvidia/maxwell/default.nix @@ -0,0 +1,7 @@ +{lib, ...}: +{ + imports = [ ../. ]; + + # The open source driver does not support Maxwell GPUs. + hardware.nvidia.open = false; +} diff --git a/common/gpu/nvidia/pascal/default.nix b/common/gpu/nvidia/pascal/default.nix new file mode 100644 index 000000000..ad3555dc1 --- /dev/null +++ b/common/gpu/nvidia/pascal/default.nix @@ -0,0 +1,7 @@ +{lib, ...}: +{ + imports = [ ../. ]; + + # The open source driver does not support Pascal GPUs. + hardware.nvidia.open = false; +} diff --git a/common/gpu/nvidia/turing/default.nix b/common/gpu/nvidia/turing/default.nix new file mode 100644 index 000000000..9a0657692 --- /dev/null +++ b/common/gpu/nvidia/turing/default.nix @@ -0,0 +1,10 @@ +{lib, config, ...}: +let + nividiaPackage = config.hardware.nvidia.package; +in +{ + imports = [ ../. ]; + + # enable the opensorce drivers if the package supports it + hardware.nvidia.open = lib.mkDefault (nividiaPackage ? open && nividiaPackage ? firmware); +} diff --git a/flake.nix b/flake.nix index 619d4b90e..9b8d6ec89 100644 --- a/flake.nix +++ b/flake.nix @@ -295,6 +295,11 @@ common-gpu-nvidia-sync = import ./common/gpu/nvidia/prime-sync.nix; common-gpu-nvidia-nonprime = import ./common/gpu/nvidia; common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix; + common-gpu-nvidia-ada-lovelace = import ./common/gpu/nvidia/ada-lovelace; + common-gpu-nvidia-ampere = import ./common/gpu/nvidia/ampere; + common-gpu-nvidia-turing = import ./common/gpu/nvidia/turing; + common-gpu-nvidia-pascal = import ./common/gpu/nvidia/pascal; + common-gpu-nvidia-maxwell = import ./common/gpu/nvidia/maxwell; common-hidpi = import ./common/hidpi.nix; common-pc = import ./common/pc; common-pc-hdd = import ./common/pc/hdd; From 82f9a8ae8a2be5828a7165f3e8a2c7830119b072 Mon Sep 17 00:00:00 2001 From: Bradley Nelson Date: Sat, 31 Aug 2024 16:43:01 -0600 Subject: [PATCH 2/5] feat: Add support for NVIDIA microarchitecture to xps 7590 and 9570 --- dell/xps/15-7590/nvidia/default.nix | 3 ++- dell/xps/15-9570/nvidia/default.nix | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dell/xps/15-7590/nvidia/default.nix b/dell/xps/15-7590/nvidia/default.nix index a4130e857..78da989df 100644 --- a/dell/xps/15-7590/nvidia/default.nix +++ b/dell/xps/15-7590/nvidia/default.nix @@ -3,13 +3,14 @@ imports = [ ../. ../../../../common/gpu/nvidia/prime.nix + ../../../../common/gpu/nvidia/turing ]; hardware.nvidia = { powerManagement = { # Enable NVIDIA power management. enable = lib.mkDefault true; - + # Enable dynamic power management. finegrained = lib.mkDefault true; }; diff --git a/dell/xps/15-9570/nvidia/default.nix b/dell/xps/15-9570/nvidia/default.nix index e58fa5819..430e0e90c 100644 --- a/dell/xps/15-9570/nvidia/default.nix +++ b/dell/xps/15-9570/nvidia/default.nix @@ -4,6 +4,7 @@ imports = [ ../../../../common/cpu/intel ../../../../common/gpu/nvidia/prime.nix + ../../../../common/gpu/nvidia/pascal ../../../../common/pc/laptop ../xps-common.nix ]; From d19eab88853d6eb7166338dc6727fc52c0aa3ba0 Mon Sep 17 00:00:00 2001 From: Bradley Nelson Date: Sat, 31 Aug 2024 19:52:44 -0600 Subject: [PATCH 3/5] fix: Update NVIDIA GPU configurations to use mkOverride --- common/gpu/nvidia/ada-lovelace/default.nix | 2 +- common/gpu/nvidia/ampere/default.nix | 2 +- common/gpu/nvidia/turing/default.nix | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/gpu/nvidia/ada-lovelace/default.nix b/common/gpu/nvidia/ada-lovelace/default.nix index 9a0657692..a9223136e 100644 --- a/common/gpu/nvidia/ada-lovelace/default.nix +++ b/common/gpu/nvidia/ada-lovelace/default.nix @@ -6,5 +6,5 @@ in imports = [ ../. ]; # enable the opensorce drivers if the package supports it - hardware.nvidia.open = lib.mkDefault (nividiaPackage ? open && nividiaPackage ? firmware); + hardware.nvidia.open = lib.mkOverride 990 (nividiaPackage ? open && nividiaPackage ? firmware); } diff --git a/common/gpu/nvidia/ampere/default.nix b/common/gpu/nvidia/ampere/default.nix index 9a0657692..a9223136e 100644 --- a/common/gpu/nvidia/ampere/default.nix +++ b/common/gpu/nvidia/ampere/default.nix @@ -6,5 +6,5 @@ in imports = [ ../. ]; # enable the opensorce drivers if the package supports it - hardware.nvidia.open = lib.mkDefault (nividiaPackage ? open && nividiaPackage ? firmware); + hardware.nvidia.open = lib.mkOverride 990 (nividiaPackage ? open && nividiaPackage ? firmware); } diff --git a/common/gpu/nvidia/turing/default.nix b/common/gpu/nvidia/turing/default.nix index 9a0657692..a9223136e 100644 --- a/common/gpu/nvidia/turing/default.nix +++ b/common/gpu/nvidia/turing/default.nix @@ -6,5 +6,5 @@ in imports = [ ../. ]; # enable the opensorce drivers if the package supports it - hardware.nvidia.open = lib.mkDefault (nividiaPackage ? open && nividiaPackage ? firmware); + hardware.nvidia.open = lib.mkOverride 990 (nividiaPackage ? open && nividiaPackage ? firmware); } From 049a42982e6f3462fc083d913f2ac85ca50ef4c1 Mon Sep 17 00:00:00 2001 From: Bradley Nelson Date: Sun, 1 Sep 2024 12:09:28 -0600 Subject: [PATCH 4/5] fix: spelling errors --- common/gpu/nvidia/ada-lovelace/default.nix | 2 +- common/gpu/nvidia/ampere/default.nix | 2 +- common/gpu/nvidia/turing/default.nix | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/gpu/nvidia/ada-lovelace/default.nix b/common/gpu/nvidia/ada-lovelace/default.nix index a9223136e..67b1b123f 100644 --- a/common/gpu/nvidia/ada-lovelace/default.nix +++ b/common/gpu/nvidia/ada-lovelace/default.nix @@ -5,6 +5,6 @@ in { imports = [ ../. ]; - # enable the opensorce drivers if the package supports it + # enable the open source drivers if the package supports it hardware.nvidia.open = lib.mkOverride 990 (nividiaPackage ? open && nividiaPackage ? firmware); } diff --git a/common/gpu/nvidia/ampere/default.nix b/common/gpu/nvidia/ampere/default.nix index a9223136e..67b1b123f 100644 --- a/common/gpu/nvidia/ampere/default.nix +++ b/common/gpu/nvidia/ampere/default.nix @@ -5,6 +5,6 @@ in { imports = [ ../. ]; - # enable the opensorce drivers if the package supports it + # enable the open source drivers if the package supports it hardware.nvidia.open = lib.mkOverride 990 (nividiaPackage ? open && nividiaPackage ? firmware); } diff --git a/common/gpu/nvidia/turing/default.nix b/common/gpu/nvidia/turing/default.nix index a9223136e..67b1b123f 100644 --- a/common/gpu/nvidia/turing/default.nix +++ b/common/gpu/nvidia/turing/default.nix @@ -5,6 +5,6 @@ in { imports = [ ../. ]; - # enable the opensorce drivers if the package supports it + # enable the open source drivers if the package supports it hardware.nvidia.open = lib.mkOverride 990 (nividiaPackage ? open && nividiaPackage ? firmware); } From a37f25508ed121d245c04153620ba69ae0d73414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 3 Sep 2024 19:11:54 +0200 Subject: [PATCH 5/5] flake.nix: don't expose nvidia modules we don't want to increase the api further. --- flake.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/flake.nix b/flake.nix index 9b8d6ec89..619d4b90e 100644 --- a/flake.nix +++ b/flake.nix @@ -295,11 +295,6 @@ common-gpu-nvidia-sync = import ./common/gpu/nvidia/prime-sync.nix; common-gpu-nvidia-nonprime = import ./common/gpu/nvidia; common-gpu-nvidia-disable = import ./common/gpu/nvidia/disable.nix; - common-gpu-nvidia-ada-lovelace = import ./common/gpu/nvidia/ada-lovelace; - common-gpu-nvidia-ampere = import ./common/gpu/nvidia/ampere; - common-gpu-nvidia-turing = import ./common/gpu/nvidia/turing; - common-gpu-nvidia-pascal = import ./common/gpu/nvidia/pascal; - common-gpu-nvidia-maxwell = import ./common/gpu/nvidia/maxwell; common-hidpi = import ./common/hidpi.nix; common-pc = import ./common/pc; common-pc-hdd = import ./common/pc/hdd;