From 20c5d0adfb4cd7a06b7c1251cb0852f404d93e59 Mon Sep 17 00:00:00 2001 From: Kiskae Date: Sun, 25 Aug 2024 18:04:04 +0200 Subject: [PATCH] nixos/nvidia: make the nvidia driver variant a mandatory user choice fixes #329450 --- nixos/doc/manual/release-notes/rl-2411.section.md | 2 ++ nixos/modules/hardware/video/nvidia.nix | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 2792f3f2ad8be1e..9bef55f4fc48164 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -137,6 +137,8 @@ Processes also now run as a dynamically allocated user by default instead of root. +- The nvidia driver no longer defaults to the proprietary driver starting with version 560. You will need to manually set `hardware.nvidia.open` to select the proprietary or open driver. + - `singularity-tools` have the `storeDir` argument removed from its override interface and use `builtins.storeDir` instead. - Two build helpers in `singularity-tools`, i.e., `mkLayer` and `shellScript`, are deprecated, as they are no longer involved in image-building. Maintainers will remove them in future releases. diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index ee8904da8572fb8..4b0dc73a44b185f 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -254,10 +254,13 @@ in ''; }; - open = lib.mkEnableOption '' - the open source NVIDIA kernel module - '' // { - defaultText = lib.literalExpression ''lib.versionAtLeast config.hardware.nvidia.package.version "560"''; + open = lib.mkOption { + example = true; + description = "Whether to enable the open source NVIDIA kernel module."; + type = lib.types.bool; + defaultText = lib.literalExpression '' + lib.mkIf (lib.versionOlder config.hardware.nvidia.package.version "560") false + ''; }; }; }; @@ -308,7 +311,7 @@ in }; environment.systemPackages = [ nvidia_x11.bin ]; - hardware.nvidia.open = lib.mkDefault (lib.versionAtLeast nvidia_x11.version "560"); + hardware.nvidia.open = lib.mkIf (lib.versionOlder nvidia_x11.version "560") (lib.mkDefault false); }) # X11