-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start decoupling X and graphics support with videoDrivers
#153808
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,77 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
|
||
# Abbreviations. | ||
cfg = config.hardware.graphics; | ||
xorg = pkgs.xorg; | ||
|
||
|
||
in | ||
|
||
{ | ||
|
||
imports = [ | ||
(mkRenamedOptionModule [ "services" "xserver" "videoDrivers" ] [ "hardware" "graphics" "videoDrivers" ]) | ||
]; | ||
|
||
|
||
|
||
###### interface | ||
|
||
options = { | ||
|
||
hardware.graphics = { | ||
|
||
enable = mkOption { | ||
type = types.bool; | ||
default = config.services.xserver.enable; | ||
description = '' | ||
Whether to enable GPU support, whether for graphics like X or Wayland, or other purposes. | ||
''; | ||
}; | ||
|
||
videoDrivers = mkOption { | ||
type = types.listOf types.str; | ||
default = [ "amdgpu" "radeon" "nouveau" "modesetting" "fbdev" ]; | ||
example = [ | ||
"nvidia" "nvidiaLegacy390" "nvidiaLegacy340" "nvidiaLegacy304" | ||
"amdgpu-pro" | ||
]; | ||
# TODO(@oxij): think how to easily add the rest, like those nvidia things | ||
relatedPackages = concatLists | ||
(mapAttrsToList (n: v: | ||
optional (hasPrefix "xf86video" n) { | ||
path = [ "xorg" n ]; | ||
title = removePrefix "xf86video" n; | ||
}) pkgs.xorg); | ||
description = '' | ||
The names of the video drivers the configuration | ||
supports. They will be tried in order until one that | ||
supports your card is found. | ||
Don't combine those with "incompatible" OpenGL implementations, | ||
e.g. free ones (mesa-based) with proprietary ones. | ||
|
||
For unfree "nvidia*", the supported GPU lists are on | ||
https://www.nvidia.com/object/unix.html | ||
''; | ||
}; | ||
|
||
}; | ||
|
||
}; | ||
|
||
|
||
|
||
###### implementation | ||
|
||
config = mkIf cfg.enable { | ||
|
||
|
||
}; | ||
|
||
# uses relatedPackages | ||
meta.buildDocsInSandbox = false; | ||
} |
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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ with lib; | |
|
||
let | ||
nvidia_x11 = let | ||
drivers = config.services.xserver.videoDrivers; | ||
drivers = config.hardware.graphics.videoDrivers; | ||
isDeprecated = str: (hasPrefix "nvidia" str) && (str != "nvidia"); | ||
hasDeprecated = drivers: any isDeprecated drivers; | ||
in if (hasDeprecated drivers) then | ||
|
@@ -107,7 +107,7 @@ in | |
without a multiplexer. | ||
|
||
Note that this option only has any effect if the "nvidia" driver is specified | ||
in <option>services.xserver.videoDrivers</option>, and it should preferably | ||
in <option>hardware.graphics.videoDrivers</option>, and it should preferably | ||
be the only driver there. | ||
|
||
If this is enabled, then the bus IDs of the NVIDIA and Intel GPUs have to be | ||
|
@@ -341,7 +341,7 @@ in | |
|
||
# nvidia-uvm is required by CUDA applications. | ||
boot.kernelModules = [ "nvidia-uvm" ] ++ | ||
optionals config.services.xserver.enable [ "nvidia" "nvidia_modeset" "nvidia_drm" ]; | ||
optionals config.hardware.graphics.enable [ "nvidia" "nvidia_modeset" "nvidia_drm" ]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just ran into this myself, I think. This is what I was looking for. 👍 |
||
|
||
# If requested enable modesetting via kernel parameter. | ||
boot.kernelParams = optional (offloadCfg.enable || cfg.modesetting.enable) "nvidia-drm.modeset=1" | ||
|
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note nothing happens yet, because the boot modules are appended per-card.