Skip to content

Commit

Permalink
nixos/nvidia: allow the gsp to be toggled independently from open sou…
Browse files Browse the repository at this point in the history
…rce driver

fixes #323886
  • Loading branch information
Kiskae committed Aug 25, 2024
1 parent 20c5d0a commit ef3b6ad
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions nixos/modules/hardware/video/nvidia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ in
lib.mkIf (lib.versionOlder config.hardware.nvidia.package.version "560") false
'';
};

gsp.enable = lib.mkEnableOption ''
the GPU System Processor (GSP) on the video card
'' // {
defaultText = lib.literalExpression ''
config.hardware.nvidia.open || lib.versionAtLeast config.hardware.nvidia.package.version "555"
'';
};
};
};

Expand Down Expand Up @@ -312,6 +320,7 @@ in
environment.systemPackages = [ nvidia_x11.bin ];

hardware.nvidia.open = lib.mkIf (lib.versionOlder nvidia_x11.version "560") (lib.mkDefault false);
hardware.nvidia.gsp.enable = lib.mkDefault (cfg.open || lib.versionAtLeast nvidia_x11.version "555");
})

# X11
Expand Down Expand Up @@ -370,8 +379,18 @@ in
}

{
assertion = cfg.open -> (cfg.package ? open && cfg.package ? firmware);
message = "This version of NVIDIA driver does not provide a corresponding opensource kernel driver";
assertion = cfg.gsp.enable -> (cfg.package ? firmware);
message = "This version of NVIDIA driver does not provide a GSP firmware.";
}

{
assertion = cfg.open -> (cfg.package ? open);
message = "This version of NVIDIA driver does not provide a corresponding opensource kernel driver.";
}

{
assertion = cfg.open -> cfg.gsp.enable;
message = "The GSP cannot be disabled when using the opensource kernel driver.";
}

{
Expand Down Expand Up @@ -558,7 +577,7 @@ in

services.dbus.packages = lib.optional cfg.dynamicBoost.enable nvidia_x11.bin;

hardware.firmware = lib.optional (cfg.open || lib.versionAtLeast nvidia_x11.version "555") nvidia_x11.firmware;
hardware.firmware = lib.optional cfg.gsp.enable nvidia_x11.firmware;

systemd.tmpfiles.rules =
[
Expand Down

0 comments on commit ef3b6ad

Please sign in to comment.