forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the NVIDIA support into its own module
Previously all card-specific stuff was scattered across xserver.nix and opengl.nix, which is ugly. Now it can be kept together in a single card-specific module. This required the addition of a few internal options: - services.xserver.drivers: A list of { name, driverName, modules, libPath } sets. - hardware.opengl.package: The OpenGL implementation. Note that there can be only one OpenGL implementation at a time in a system configuration (i.e. no dynamic detection). - hardware.opengl.package32: The 32-bit OpenGL implementation.
- Loading branch information
Showing
4 changed files
with
142 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# This module provides the proprietary NVIDIA X11 / OpenGL drivers. | ||
|
||
{ config, lib, pkgs, pkgs_i686, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
|
||
drivers = config.services.xserver.videoDrivers; | ||
|
||
# FIXME: should introduce an option like | ||
# ‘hardware.video.nvidia.package’ for overriding the default NVIDIA | ||
# driver. | ||
enabled = elem "nvidia" drivers || elem "nvidiaLegacy173" drivers || elem "nvidiaLegacy304" drivers; | ||
|
||
nvidia_x11 = | ||
if elem "nvidia" drivers then | ||
config.boot.kernelPackages.nvidia_x11 | ||
else if elem "nvidiaLegacy173" drivers then | ||
config.boot.kernelPackages.nvidia_x11_legacy173 | ||
else if elem "nvidiaLegacy304" videoDrivers then | ||
config.boot.kernelPackages.nvidia_x11_legacy304 | ||
else throw "impossible"; | ||
|
||
in | ||
|
||
{ | ||
|
||
config = mkIf enabled { | ||
|
||
services.xserver.drivers = singleton | ||
{ name = "nvidia"; modules = [ nvidia_x11 ]; libPath = [ nvidia_x11 ]; }; | ||
|
||
services.xserver.screenSection = | ||
'' | ||
Option "RandRRotation" "on" | ||
''; | ||
|
||
hardware.opengl.package = nvidia_x11; | ||
hardware.opengl.package32 = pkgs_i686.linuxPackages.nvidia_x11.override { libsOnly = true; kernel = null; }; | ||
|
||
environment.systemPackages = [ nvidia_x11 ]; | ||
|
||
boot.extraModulePackages = [ nvidia_x11 ]; | ||
|
||
boot.blacklistedKernelModules = [ "nouveau" "nvidiafb" ]; | ||
|
||
services.acpid.enable = true; | ||
|
||
environment.etc."OpenCL/vendors/nvidia.icd".source = "${nvidia_x11}/lib/vendors/nvidia.icd"; | ||
|
||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters