nixos/xserver: introduce attr display to xserver.drivers

Specifically for NVIDIA so that only the device section would be created
This commit is contained in:
Edmund Wu
2019-12-10 11:35:29 -05:00
parent e8daa1e35c
commit 632a8a7bb2
4 changed files with 50 additions and 51 deletions
+35 -33
View File
@@ -574,7 +574,7 @@ in
then { modules = [xorg.${"xf86video" + name}]; }
else null)
knownVideoDrivers;
in optional (driver != null) ({ inherit name; modules = []; driverName = name; } // driver));
in optional (driver != null) ({ inherit name; modules = []; driverName = name; display = true; } // driver));
assertions = [
{ assertion = config.security.polkit.enable;
@@ -749,7 +749,7 @@ in
${cfg.serverLayoutSection}
# Reference the Screen sections for each driver. This will
# cause the X server to try each in turn.
${flip concatMapStrings cfg.drivers (d: ''
${flip concatMapStrings (filter (d: d.display) cfg.drivers) (d: ''
Screen "Screen-${d.name}[0]"
'')}
EndSection
@@ -773,42 +773,44 @@ in
${driver.deviceSection or ""}
${xrandrDeviceSection}
EndSection
${optionalString driver.display ''
Section "Screen"
Identifier "Screen-${driver.name}[0]"
Device "Device-${driver.name}[0]"
${optionalString (cfg.monitorSection != "") ''
Monitor "Monitor[0]"
''}
Section "Screen"
Identifier "Screen-${driver.name}[0]"
Device "Device-${driver.name}[0]"
${optionalString (cfg.monitorSection != "") ''
Monitor "Monitor[0]"
''}
${cfg.screenSection}
${driver.screenSection or ""}
${cfg.screenSection}
${driver.screenSection or ""}
${optionalString (cfg.defaultDepth != 0) ''
DefaultDepth ${toString cfg.defaultDepth}
''}
${optionalString (cfg.defaultDepth != 0) ''
DefaultDepth ${toString cfg.defaultDepth}
''}
${optionalString
(driver.name != "virtualbox" &&
(cfg.resolutions != [] ||
cfg.extraDisplaySettings != "" ||
cfg.virtualScreen != null))
(let
f = depth:
''
SubSection "Display"
Depth ${toString depth}
${optionalString (cfg.resolutions != [])
"Modes ${concatMapStrings (res: ''"${toString res.x}x${toString res.y}"'') cfg.resolutions}"}
${cfg.extraDisplaySettings}
${optionalString (cfg.virtualScreen != null)
"Virtual ${toString cfg.virtualScreen.x} ${toString cfg.virtualScreen.y}"}
EndSubSection
'';
in concatMapStrings f [8 16 24]
)}
${optionalString
(driver.name != "virtualbox" &&
(cfg.resolutions != [] ||
cfg.extraDisplaySettings != "" ||
cfg.virtualScreen != null))
(let
f = depth:
''
SubSection "Display"
Depth ${toString depth}
${optionalString (cfg.resolutions != [])
"Modes ${concatMapStrings (res: ''"${toString res.x}x${toString res.y}"'') cfg.resolutions}"}
${cfg.extraDisplaySettings}
${optionalString (cfg.virtualScreen != null)
"Virtual ${toString cfg.virtualScreen.x} ${toString cfg.virtualScreen.y}"}
EndSubSection
'';
in concatMapStrings f [8 16 24]
)}
EndSection
EndSection
''}
'')}
${xrandrMonitorSections}