2018-07-20 21:56:59 +01:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
2006-11-28 22:27:56 +00:00
|
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
|
with lib;
|
2009-05-24 19:28:30 +01:00
|
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
|
let
|
2006-11-28 22:27:56 +00:00
|
|
|
|
|
2008-01-04 10:54:33 +00:00
|
|
|
|
# Abbreviations.
|
|
|
|
|
cfg = config.services.xserver;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
xorg = pkgs.xorg;
|
|
|
|
|
|
2008-01-04 10:54:33 +00:00
|
|
|
|
|
2014-04-29 13:16:34 +01:00
|
|
|
|
# Map video driver names to driver packages. FIXME: move into card-specific modules.
|
2008-10-10 17:45:56 +01:00
|
|
|
|
knownVideoDrivers = {
|
2018-11-12 19:29:14 +00:00
|
|
|
|
# Alias so people can keep using "virtualbox" instead of "vboxvideo".
|
|
|
|
|
virtualbox = { modules = [ xorg.xf86videovboxvideo ]; driverName = "vboxvideo"; };
|
2016-08-05 17:29:02 +01:00
|
|
|
|
|
2019-07-16 21:52:33 +01:00
|
|
|
|
# Alias so that "radeon" uses the xf86-video-ati driver.
|
|
|
|
|
radeon = { modules = [ xorg.xf86videoati ]; driverName = "ati"; };
|
|
|
|
|
|
2016-08-05 17:29:02 +01:00
|
|
|
|
# modesetting does not have a xf86videomodesetting package as it is included in xorgserver
|
|
|
|
|
modesetting = {};
|
2008-10-10 17:45:56 +01:00
|
|
|
|
};
|
|
|
|
|
|
2008-08-27 11:00:49 +01:00
|
|
|
|
fontsForXServer =
|
2009-09-10 13:37:33 +01:00
|
|
|
|
config.fonts.fonts ++
|
2008-08-27 11:00:49 +01:00
|
|
|
|
# We don't want these fonts in fonts.conf, because then modern,
|
|
|
|
|
# fontconfig-based applications will get horrible bitmapped
|
|
|
|
|
# Helvetica fonts. It's better to get a substitution (like Nimbus
|
|
|
|
|
# Sans) than that horror. But we do need the Adobe fonts for some
|
|
|
|
|
# old non-fontconfig applications. (Possibly this could be done
|
|
|
|
|
# better using a fontconfig rule.)
|
|
|
|
|
[ pkgs.xorg.fontadobe100dpi
|
|
|
|
|
pkgs.xorg.fontadobe75dpi
|
|
|
|
|
];
|
2009-06-26 00:29:49 +01:00
|
|
|
|
|
2017-04-24 10:08:33 +01:00
|
|
|
|
xrandrOptions = {
|
|
|
|
|
output = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
example = "DVI-0";
|
|
|
|
|
description = ''
|
|
|
|
|
The output name of the monitor, as shown by <citerefentry>
|
|
|
|
|
<refentrytitle>xrandr</refentrytitle>
|
|
|
|
|
<manvolnum>1</manvolnum>
|
|
|
|
|
</citerefentry> invoked without arguments.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
primary = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether this head is treated as the primary monitor,
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
monitorConfig = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = "";
|
|
|
|
|
example = ''
|
|
|
|
|
DisplaySize 408 306
|
|
|
|
|
Option "DPMS" "false"
|
|
|
|
|
'';
|
|
|
|
|
description = ''
|
|
|
|
|
Extra lines to append to the <literal>Monitor</literal> section
|
2019-02-28 23:44:19 +00:00
|
|
|
|
verbatim. Available options are documented in the MONITOR section in
|
|
|
|
|
<citerefentry><refentrytitle>xorg.conf</refentrytitle>
|
|
|
|
|
<manvolnum>5</manvolnum></citerefentry>.
|
2017-04-24 10:08:33 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
2013-01-24 12:06:32 +00:00
|
|
|
|
|
2013-01-09 23:31:08 +00:00
|
|
|
|
# Just enumerate all heads without discarding XRandR output information.
|
|
|
|
|
xrandrHeads = let
|
2017-04-24 10:08:33 +01:00
|
|
|
|
mkHead = num: config: {
|
2013-01-09 23:31:08 +00:00
|
|
|
|
name = "multihead${toString num}";
|
2017-04-24 10:08:33 +01:00
|
|
|
|
inherit config;
|
2013-01-09 23:31:08 +00:00
|
|
|
|
};
|
2017-07-04 23:29:23 +01:00
|
|
|
|
in imap1 mkHead cfg.xrandrHeads;
|
2013-01-09 23:31:08 +00:00
|
|
|
|
|
2015-04-18 19:04:03 +01:00
|
|
|
|
xrandrDeviceSection = let
|
2019-08-05 12:03:38 +01:00
|
|
|
|
monitors = forEach xrandrHeads (h: ''
|
2017-04-24 10:08:33 +01:00
|
|
|
|
Option "monitor-${h.config.output}" "${h.name}"
|
2015-04-18 19:04:03 +01:00
|
|
|
|
'');
|
|
|
|
|
# First option is indented through the space in the config but any
|
|
|
|
|
# subsequent options aren't so we need to apply indentation to
|
|
|
|
|
# them here
|
|
|
|
|
monitorsIndented = if length monitors > 1
|
|
|
|
|
then singleton (head monitors) ++ map (m: " " + m) (tail monitors)
|
|
|
|
|
else monitors;
|
|
|
|
|
in concatStrings monitorsIndented;
|
2013-01-09 23:31:08 +00:00
|
|
|
|
|
|
|
|
|
# Here we chain every monitor from the left to right, so we have:
|
|
|
|
|
# m4 right of m3 right of m2 right of m1 .----.----.----.----.
|
|
|
|
|
# Which will end up in reverse ----------> | m1 | m2 | m3 | m4 |
|
|
|
|
|
# `----^----^----^----'
|
|
|
|
|
xrandrMonitorSections = let
|
2015-04-18 18:34:28 +01:00
|
|
|
|
mkMonitor = previous: current: singleton {
|
2013-01-09 23:31:08 +00:00
|
|
|
|
inherit (current) name;
|
|
|
|
|
value = ''
|
|
|
|
|
Section "Monitor"
|
|
|
|
|
Identifier "${current.name}"
|
2017-04-24 10:08:33 +01:00
|
|
|
|
${optionalString (current.config.primary) ''
|
2016-03-14 13:00:55 +00:00
|
|
|
|
Option "Primary" "true"
|
|
|
|
|
''}
|
2013-01-09 23:31:08 +00:00
|
|
|
|
${optionalString (previous != []) ''
|
|
|
|
|
Option "RightOf" "${(head previous).name}"
|
|
|
|
|
''}
|
2017-04-24 10:08:33 +01:00
|
|
|
|
${current.config.monitorConfig}
|
2013-01-09 23:31:08 +00:00
|
|
|
|
EndSection
|
|
|
|
|
'';
|
2015-04-18 18:34:28 +01:00
|
|
|
|
} ++ previous;
|
|
|
|
|
monitors = reverseList (foldl mkMonitor [] xrandrHeads);
|
2013-01-09 23:31:08 +00:00
|
|
|
|
in concatMapStrings (getAttr "value") monitors;
|
2009-06-26 00:29:49 +01:00
|
|
|
|
|
2016-09-27 14:26:37 +01:00
|
|
|
|
configFile = pkgs.runCommand "xserver.conf"
|
|
|
|
|
{ xfs = optionalString (cfg.useXFS != false)
|
|
|
|
|
''FontPath "${toString cfg.useXFS}"'';
|
|
|
|
|
inherit (cfg) config;
|
2018-11-08 10:59:03 +00:00
|
|
|
|
preferLocalBuild = true;
|
2016-09-27 14:26:37 +01:00
|
|
|
|
}
|
2009-09-10 13:37:33 +01:00
|
|
|
|
''
|
|
|
|
|
echo 'Section "Files"' >> $out
|
|
|
|
|
echo $xfs >> $out
|
|
|
|
|
|
|
|
|
|
for i in ${toString fontsForXServer}; do
|
|
|
|
|
if test "''${i:0:''${#NIX_STORE}}" == "$NIX_STORE"; then
|
|
|
|
|
for j in $(find $i -name fonts.dir); do
|
|
|
|
|
echo " FontPath \"$(dirname $j)\"" >> $out
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
done
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
for i in $(find ${toString cfg.modules} -type d); do
|
|
|
|
|
if test $(echo $i/*.so* | wc -w) -ne 0; then
|
|
|
|
|
echo " ModulePath \"$i\"" >> $out
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo 'EndSection' >> $out
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
echo "$config" >> $out
|
|
|
|
|
''; # */
|
2006-11-28 22:27:56 +00:00
|
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
|
in
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
{
|
2009-05-15 08:51:51 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
imports =
|
|
|
|
|
[ ./display-managers/default.nix
|
|
|
|
|
./window-managers/default.nix
|
|
|
|
|
./desktop-managers/default.nix
|
2019-12-10 01:51:19 +00:00
|
|
|
|
(mkRemovedOptionModule [ "services" "xserver" "startGnuPGAgent" ]
|
|
|
|
|
"See the 16.09 release notes for more information.")
|
2009-09-10 13:37:33 +01:00
|
|
|
|
];
|
2009-05-15 08:51:51 +01:00
|
|
|
|
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
###### interface
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
options = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
services.xserver = {
|
|
|
|
|
|
|
|
|
|
enable = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.bool;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to enable the X server.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
autorun = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.bool;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to start the X server automatically.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
exportConfiguration = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.bool;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to symlink the X server configuration under
|
|
|
|
|
<filename>/etc/X11/xorg.conf</filename>.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
enableTCP = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.bool;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to allow the X server to accept TCP connections.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:39 +00:00
|
|
|
|
|
2016-10-01 20:44:58 +01:00
|
|
|
|
autoRepeatDelay = mkOption {
|
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
|
default = null;
|
|
|
|
|
description = ''
|
|
|
|
|
Sets the autorepeat delay (length of time in milliseconds that a key must be depressed before autorepeat starts).
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
autoRepeatInterval = mkOption {
|
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
|
default = null;
|
|
|
|
|
description = ''
|
|
|
|
|
Sets the autorepeat interval (length of time in milliseconds that should elapse between autorepeat-generated keystrokes).
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-04-12 22:49:48 +01:00
|
|
|
|
inputClassSections = mkOption {
|
|
|
|
|
type = types.listOf types.lines;
|
|
|
|
|
default = [];
|
2015-07-04 07:52:50 +01:00
|
|
|
|
example = literalExample ''
|
|
|
|
|
[ '''
|
|
|
|
|
Identifier "Trackpoint Wheel Emulation"
|
|
|
|
|
MatchProduct "ThinkPad USB Keyboard with TrackPoint"
|
2016-03-18 09:25:37 +00:00
|
|
|
|
Option "EmulateWheel" "true"
|
2015-07-04 07:52:50 +01:00
|
|
|
|
Option "EmulateWheelButton" "2"
|
|
|
|
|
Option "Emulate3Buttons" "false"
|
|
|
|
|
'''
|
|
|
|
|
]
|
|
|
|
|
'';
|
2015-04-12 22:49:48 +01:00
|
|
|
|
description = "Content of additional InputClass sections of the X server configuration file.";
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
modules = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.listOf types.path;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = [];
|
2014-08-27 22:41:15 +01:00
|
|
|
|
example = literalExample "[ pkgs.xf86_input_wacom ]";
|
2009-09-10 13:37:33 +01:00
|
|
|
|
description = "Packages to be added to the module search path of the X server.";
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
resolutions = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.listOf types.attrs;
|
2009-11-06 00:59:03 +00:00
|
|
|
|
default = [];
|
2010-08-09 21:10:16 +01:00
|
|
|
|
example = [ { x = 1600; y = 1200; } { x = 1024; y = 786; } ];
|
2009-09-10 13:37:33 +01:00
|
|
|
|
description = ''
|
2009-11-06 00:59:03 +00:00
|
|
|
|
The screen resolutions for the X server. The first element
|
|
|
|
|
is the default resolution. If this list is empty, the X
|
|
|
|
|
server will automatically configure the resolution.
|
2009-09-10 13:37:33 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2014-04-29 11:58:54 +01:00
|
|
|
|
videoDrivers = mkOption {
|
|
|
|
|
type = types.listOf types.str;
|
|
|
|
|
# !!! We'd like "nv" here, but it segfaults the X server.
|
2019-07-16 21:52:33 +01:00
|
|
|
|
default = [ "radeon" "cirrus" "vesa" "vmware" "modesetting" ];
|
2018-04-25 08:12:04 +01:00
|
|
|
|
example = [
|
|
|
|
|
"ati_unfree" "amdgpu" "amdgpu-pro"
|
2019-03-22 12:59:48 +00:00
|
|
|
|
"nv" "nvidia" "nvidiaLegacy390" "nvidiaLegacy340" "nvidiaLegacy304"
|
2018-04-25 08:12:04 +01:00
|
|
|
|
];
|
2018-04-25 08:12:04 +01:00
|
|
|
|
# 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);
|
2014-04-29 11:58:54 +01:00
|
|
|
|
description = ''
|
|
|
|
|
The names of the video drivers the configuration
|
|
|
|
|
supports. They will be tried in order until one that
|
|
|
|
|
supports your card is found.
|
2019-03-22 12:59:48 +00:00
|
|
|
|
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
|
2014-04-29 11:58:54 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
videoDriver = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.nullOr types.str;
|
2009-11-06 00:59:03 +00:00
|
|
|
|
default = null;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
example = "i810";
|
|
|
|
|
description = ''
|
2009-11-06 00:59:03 +00:00
|
|
|
|
The name of the video driver for your graphics card. This
|
|
|
|
|
option is obsolete; please set the
|
2014-04-29 11:58:54 +01:00
|
|
|
|
<option>services.xserver.videoDrivers</option> instead.
|
2009-09-10 13:37:33 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2014-04-29 13:16:34 +01:00
|
|
|
|
drivers = mkOption {
|
|
|
|
|
type = types.listOf types.attrs;
|
|
|
|
|
internal = true;
|
|
|
|
|
description = ''
|
|
|
|
|
A list of attribute sets specifying drivers to be loaded by
|
|
|
|
|
the X11 server.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2016-04-09 02:53:42 +01:00
|
|
|
|
dpi = mkOption {
|
|
|
|
|
type = types.nullOr types.int;
|
2016-04-10 16:46:17 +01:00
|
|
|
|
default = null;
|
2016-04-09 02:53:42 +01:00
|
|
|
|
description = "DPI resolution to use for X server.";
|
|
|
|
|
};
|
|
|
|
|
|
2015-06-22 17:08:29 +01:00
|
|
|
|
startDbusSession = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to start a new DBus session when you log in with dbus-launch.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2016-04-25 22:37:18 +01:00
|
|
|
|
updateDbusEnvironment = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to update the DBus activation environment after launching the
|
|
|
|
|
desktop manager.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
layout = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.str;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = "us";
|
|
|
|
|
description = ''
|
2017-03-23 21:14:28 +00:00
|
|
|
|
Keyboard layout, or multiple keyboard layouts separated by commas.
|
2009-09-10 13:37:33 +01:00
|
|
|
|
'';
|
2009-01-25 15:49:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
xkbModel = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.str;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = "pc104";
|
|
|
|
|
example = "presario";
|
|
|
|
|
description = ''
|
|
|
|
|
Keyboard model.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-06-26 00:29:49 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
xkbOptions = mkOption {
|
2019-11-14 14:00:00 +00:00
|
|
|
|
type = types.commas;
|
2010-08-10 13:37:39 +01:00
|
|
|
|
default = "terminate:ctrl_alt_bksp";
|
2020-01-04 18:54:19 +00:00
|
|
|
|
example = "grp:caps_toggle,grp_led:scroll";
|
2009-09-10 13:37:33 +01:00
|
|
|
|
description = ''
|
|
|
|
|
X keyboard options; layout switching goes here.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2011-12-30 23:26:11 +00:00
|
|
|
|
xkbVariant = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.str;
|
2011-12-30 23:26:11 +00:00
|
|
|
|
default = "";
|
|
|
|
|
example = "colemak";
|
|
|
|
|
description = ''
|
|
|
|
|
X keyboard variant.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-24 12:30:42 +00:00
|
|
|
|
xkbDir = mkOption {
|
2015-12-26 08:06:28 +00:00
|
|
|
|
type = types.path;
|
2019-05-13 05:12:00 +01:00
|
|
|
|
default = "${pkgs.xkeyboard_config}/etc/X11/xkb";
|
2015-12-24 12:30:42 +00:00
|
|
|
|
description = ''
|
2015-12-26 08:06:28 +00:00
|
|
|
|
Path used for -xkbdir xserver parameter.
|
2015-12-24 12:30:42 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
config = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.lines;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
description = ''
|
|
|
|
|
The contents of the configuration file of the X server
|
|
|
|
|
(<filename>xorg.conf</filename>).
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-06-03 09:14:54 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
deviceSection = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.lines;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = "";
|
|
|
|
|
example = "VideoRAM 131072";
|
|
|
|
|
description = "Contents of the first Device section of the X server configuration file.";
|
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2010-05-08 18:18:22 +01:00
|
|
|
|
screenSection = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.lines;
|
2010-05-08 18:18:22 +01:00
|
|
|
|
default = "";
|
|
|
|
|
example = ''
|
|
|
|
|
Option "RandRRotation" "on"
|
|
|
|
|
'';
|
|
|
|
|
description = "Contents of the first Screen section of the X server configuration file.";
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
monitorSection = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.lines;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = "";
|
|
|
|
|
example = "HorizSync 28-49";
|
|
|
|
|
description = "Contents of the first Monitor section of the X server configuration file.";
|
|
|
|
|
};
|
2009-04-08 14:41:33 +01:00
|
|
|
|
|
2018-06-30 08:33:45 +01:00
|
|
|
|
extraConfig = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = "";
|
|
|
|
|
description = "Additional contents (sections) included in the X server configuration file";
|
|
|
|
|
};
|
|
|
|
|
|
2013-01-09 23:31:08 +00:00
|
|
|
|
xrandrHeads = mkOption {
|
|
|
|
|
default = [];
|
2017-04-24 10:08:33 +01:00
|
|
|
|
example = [
|
|
|
|
|
"HDMI-0"
|
|
|
|
|
{ output = "DVI-0"; primary = true; }
|
|
|
|
|
{ output = "DVI-1"; monitorConfig = "Option \"Rotate\" \"left\""; }
|
|
|
|
|
];
|
|
|
|
|
type = with types; listOf (coercedTo str (output: {
|
|
|
|
|
inherit output;
|
|
|
|
|
}) (submodule { options = xrandrOptions; }));
|
2017-04-24 11:02:10 +01:00
|
|
|
|
# Set primary to true for the first head if no other has been set
|
|
|
|
|
# primary already.
|
2017-04-24 10:08:33 +01:00
|
|
|
|
apply = heads: let
|
|
|
|
|
hasPrimary = any (x: x.primary) heads;
|
|
|
|
|
firstPrimary = head heads // { primary = true; };
|
|
|
|
|
newHeads = singleton firstPrimary ++ tail heads;
|
|
|
|
|
in if heads != [] && !hasPrimary then newHeads else heads;
|
2013-01-09 23:31:08 +00:00
|
|
|
|
description = ''
|
2017-04-24 10:08:33 +01:00
|
|
|
|
Multiple monitor configuration, just specify a list of XRandR
|
|
|
|
|
outputs. The individual elements should be either simple strings or
|
|
|
|
|
an attribute set of output options.
|
2016-03-14 13:00:55 +00:00
|
|
|
|
|
2017-04-24 10:08:33 +01:00
|
|
|
|
If the element is a string, it is denoting the physical output for a
|
|
|
|
|
monitor, if it's an attribute set, you must at least provide the
|
|
|
|
|
<option>output</option> option.
|
2016-03-14 13:00:55 +00:00
|
|
|
|
|
2017-04-24 10:08:33 +01:00
|
|
|
|
The monitors will be mapped from left to right in the order of the
|
2013-01-09 23:31:08 +00:00
|
|
|
|
list.
|
|
|
|
|
|
2017-04-24 10:08:33 +01:00
|
|
|
|
By default, the first monitor will be set as the primary monitor if
|
|
|
|
|
none of the elements contain an option that has set
|
|
|
|
|
<option>primary</option> to <literal>true</literal>.
|
|
|
|
|
|
|
|
|
|
<note><para>Only one monitor is allowed to be primary.</para></note>
|
2013-01-09 23:31:08 +00:00
|
|
|
|
|
|
|
|
|
Be careful using this option with multiple graphic adapters or with
|
|
|
|
|
drivers that have poor support for XRandR, unexpected things might
|
|
|
|
|
happen with those.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2013-11-04 14:45:05 +00:00
|
|
|
|
serverFlagsSection = mkOption {
|
|
|
|
|
default = "";
|
|
|
|
|
example =
|
|
|
|
|
''
|
|
|
|
|
Option "BlankTime" "0"
|
|
|
|
|
Option "StandbyTime" "0"
|
|
|
|
|
Option "SuspendTime" "0"
|
|
|
|
|
Option "OffTime" "0"
|
|
|
|
|
'';
|
|
|
|
|
description = "Contents of the ServerFlags section of the X server configuration file.";
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
moduleSection = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.lines;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = "";
|
|
|
|
|
example =
|
|
|
|
|
''
|
|
|
|
|
SubSection "extmod"
|
|
|
|
|
EndSubsection
|
|
|
|
|
'';
|
|
|
|
|
description = "Contents of the Module section of the X server configuration file.";
|
|
|
|
|
};
|
2009-04-08 14:41:33 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
serverLayoutSection = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.lines;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = "";
|
|
|
|
|
example =
|
|
|
|
|
''
|
|
|
|
|
Option "AIGLX" "true"
|
|
|
|
|
'';
|
|
|
|
|
description = "Contents of the ServerLayout section of the X server configuration file.";
|
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
extraDisplaySettings = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.lines;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = "";
|
|
|
|
|
example = "Virtual 2048 2048";
|
|
|
|
|
description = "Lines to be added to every Display subsection of the Screen section.";
|
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
defaultDepth = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.int;
|
2009-11-06 00:59:03 +00:00
|
|
|
|
default = 0;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
example = 8;
|
|
|
|
|
description = "Default colour depth.";
|
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
useXFS = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
# FIXME: what's the type of this option?
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = false;
|
|
|
|
|
example = "unix/:7100";
|
|
|
|
|
description = "Determines how to connect to the X Font Server.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
tty = mkOption {
|
2015-11-29 00:18:59 +00:00
|
|
|
|
type = types.nullOr types.int;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = 7;
|
|
|
|
|
description = "Virtual console for the X server.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
display = mkOption {
|
2015-11-29 00:18:59 +00:00
|
|
|
|
type = types.nullOr types.int;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = 0;
|
|
|
|
|
description = "Display number for the X server.";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtualScreen = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
|
type = types.nullOr types.attrs;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
default = null;
|
|
|
|
|
example = { x = 2048; y = 2048; };
|
|
|
|
|
description = ''
|
|
|
|
|
Virtual screen size for Xrandr.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2017-05-07 22:01:20 +01:00
|
|
|
|
verbose = mkOption {
|
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
|
default = 3;
|
|
|
|
|
example = 7;
|
|
|
|
|
description = ''
|
|
|
|
|
Controls verbosity of X logging.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2014-03-16 17:46:20 +00:00
|
|
|
|
useGlamor = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to use the Glamor module for 2D acceleration,
|
|
|
|
|
if possible.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2015-11-23 14:45:26 +00:00
|
|
|
|
|
|
|
|
|
enableCtrlAltBackspace = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to enable the DontZap option, which binds Ctrl+Alt+Backspace
|
|
|
|
|
to forcefully kill X. This can lead to data loss and is disabled
|
|
|
|
|
by default.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2016-12-04 21:30:42 +00:00
|
|
|
|
|
|
|
|
|
terminateOnReset = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to terminate X upon server reset.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-09-10 13:37:33 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2013-05-16 16:23:31 +01:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
###### implementation
|
2009-11-21 22:14:01 +00:00
|
|
|
|
|
2013-10-30 17:30:23 +00:00
|
|
|
|
config = mkIf cfg.enable {
|
2014-04-29 13:16:34 +01:00
|
|
|
|
|
2018-08-20 13:25:25 +01:00
|
|
|
|
services.xserver.displayManager.lightdm.enable =
|
|
|
|
|
let dmconf = cfg.displayManager;
|
2020-01-26 22:41:19 +00:00
|
|
|
|
default = !(dmconf.gdm.enable
|
2018-08-20 13:25:25 +01:00
|
|
|
|
|| dmconf.sddm.enable
|
|
|
|
|
|| dmconf.xpra.enable );
|
|
|
|
|
in mkIf (default) true;
|
|
|
|
|
|
2014-04-29 13:16:34 +01:00
|
|
|
|
hardware.opengl.enable = mkDefault true;
|
|
|
|
|
|
2014-04-29 11:58:54 +01:00
|
|
|
|
services.xserver.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
|
2013-10-30 17:30:23 +00:00
|
|
|
|
|
2016-08-06 06:22:33 +01:00
|
|
|
|
# FIXME: somehow check for unknown driver names.
|
|
|
|
|
services.xserver.drivers = flip concatMap cfg.videoDrivers (name:
|
2014-04-29 13:16:34 +01:00
|
|
|
|
let driver =
|
|
|
|
|
attrByPath [name]
|
2014-10-04 23:03:52 +01:00
|
|
|
|
(if xorg ? ${"xf86video" + name}
|
|
|
|
|
then { modules = [xorg.${"xf86video" + name}]; }
|
2016-08-06 06:22:33 +01:00
|
|
|
|
else null)
|
2014-04-29 13:16:34 +01:00
|
|
|
|
knownVideoDrivers;
|
2019-08-14 17:37:03 +01:00
|
|
|
|
in optional (driver != null) ({ inherit name; modules = []; driverName = name; display = true; } // driver));
|
2014-04-29 13:16:34 +01:00
|
|
|
|
|
2017-04-24 10:08:33 +01:00
|
|
|
|
assertions = [
|
|
|
|
|
{ assertion = config.security.polkit.enable;
|
|
|
|
|
message = "X11 requires Polkit to be enabled (‘security.polkit.enable = true’).";
|
|
|
|
|
}
|
|
|
|
|
(let primaryHeads = filter (x: x.primary) cfg.xrandrHeads; in {
|
|
|
|
|
assertion = length primaryHeads < 2;
|
|
|
|
|
message = "Only one head is allowed to be primary in "
|
|
|
|
|
+ "‘services.xserver.xrandrHeads’, but there are "
|
|
|
|
|
+ "${toString (length primaryHeads)} heads set to primary: "
|
|
|
|
|
+ concatMapStringsSep ", " (x: x.output) primaryHeads;
|
|
|
|
|
})
|
|
|
|
|
];
|
2009-09-10 13:37:33 +01:00
|
|
|
|
|
2017-01-30 13:03:42 +00:00
|
|
|
|
environment.etc =
|
2019-09-14 18:51:29 +01:00
|
|
|
|
(optionalAttrs cfg.exportConfiguration
|
|
|
|
|
{
|
|
|
|
|
"X11/xorg.conf".source = "${configFile}";
|
2017-01-30 13:03:42 +00:00
|
|
|
|
# -xkbdir command line option does not seems to be passed to xkbcomp.
|
2019-09-14 18:51:29 +01:00
|
|
|
|
"X11/xkb".source = "${cfg.xkbDir}";
|
|
|
|
|
})
|
2017-11-30 13:10:34 +00:00
|
|
|
|
# localectl looks into 00-keyboard.conf
|
2019-09-14 18:51:29 +01:00
|
|
|
|
//{
|
|
|
|
|
"X11/xorg.conf.d/00-keyboard.conf".text = ''
|
2017-11-30 13:10:34 +00:00
|
|
|
|
Section "InputClass"
|
|
|
|
|
Identifier "Keyboard catchall"
|
|
|
|
|
MatchIsKeyboard "on"
|
|
|
|
|
Option "XkbModel" "${cfg.xkbModel}"
|
|
|
|
|
Option "XkbLayout" "${cfg.layout}"
|
|
|
|
|
Option "XkbOptions" "${cfg.xkbOptions}"
|
|
|
|
|
Option "XkbVariant" "${cfg.xkbVariant}"
|
|
|
|
|
EndSection
|
|
|
|
|
'';
|
|
|
|
|
}
|
2016-05-23 12:01:01 +01:00
|
|
|
|
# Needed since 1.18; see https://bugs.freedesktop.org/show_bug.cgi?id=89023#c5
|
2019-09-14 18:51:29 +01:00
|
|
|
|
// (let cfgPath = "/X11/xorg.conf.d/10-evdev.conf"; in
|
|
|
|
|
{
|
|
|
|
|
${cfgPath}.source = xorg.xf86inputevdev.out + "/share" + cfgPath;
|
|
|
|
|
});
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2013-10-30 16:52:35 +00:00
|
|
|
|
environment.systemPackages =
|
2015-11-25 08:47:56 +00:00
|
|
|
|
[ xorg.xorgserver.out
|
2009-09-10 13:37:33 +01:00
|
|
|
|
xorg.xrandr
|
|
|
|
|
xorg.xrdb
|
|
|
|
|
xorg.setxkbmap
|
|
|
|
|
xorg.iceauth # required for KDE applications (it's called by dcopserver)
|
2010-02-10 13:22:38 +00:00
|
|
|
|
xorg.xlsclients
|
|
|
|
|
xorg.xset
|
2009-09-10 13:37:33 +01:00
|
|
|
|
xorg.xsetroot
|
2013-04-27 02:30:40 +01:00
|
|
|
|
xorg.xinput
|
2009-09-13 14:26:35 +01:00
|
|
|
|
xorg.xprop
|
2016-04-12 18:12:47 +01:00
|
|
|
|
xorg.xauth
|
2010-02-10 13:22:38 +00:00
|
|
|
|
pkgs.xterm
|
2012-05-15 03:49:47 +01:00
|
|
|
|
pkgs.xdg_utils
|
2016-05-23 12:01:01 +01:00
|
|
|
|
xorg.xf86inputevdev.out # get evdev.4 man page
|
2009-09-10 13:37:33 +01:00
|
|
|
|
]
|
2014-09-05 10:53:36 +01:00
|
|
|
|
++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh;
|
2014-03-17 18:27:06 +00:00
|
|
|
|
|
2018-09-06 00:04:40 +01:00
|
|
|
|
environment.pathsToLink = [ "/share/X11" ];
|
|
|
|
|
|
2019-02-28 23:44:19 +00:00
|
|
|
|
xdg = {
|
2018-08-15 09:55:35 +01:00
|
|
|
|
autostart.enable = true;
|
|
|
|
|
menus.enable = true;
|
|
|
|
|
mime.enable = true;
|
|
|
|
|
icons.enable = true;
|
|
|
|
|
};
|
2011-03-30 18:52:34 +01:00
|
|
|
|
|
2015-06-12 12:02:06 +01:00
|
|
|
|
# The default max inotify watches is 8192.
|
|
|
|
|
# Nowadays most apps require a good number of inotify watches,
|
|
|
|
|
# the value below is used by default on several other distros.
|
|
|
|
|
boot.kernel.sysctl."fs.inotify.max_user_watches" = mkDefault 524288;
|
|
|
|
|
|
2013-01-16 11:33:18 +00:00
|
|
|
|
systemd.defaultUnit = mkIf cfg.autorun "graphical.target";
|
2012-06-19 19:51:04 +01:00
|
|
|
|
|
2014-04-29 13:16:34 +01:00
|
|
|
|
systemd.services.display-manager =
|
2013-01-10 12:59:41 +00:00
|
|
|
|
{ description = "X11 Server";
|
|
|
|
|
|
2017-04-28 07:25:52 +01:00
|
|
|
|
after = [ "acpid.service" "systemd-logind.service" ];
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2012-08-17 18:14:42 +01:00
|
|
|
|
restartIfChanged = false;
|
2012-03-18 02:10:39 +00:00
|
|
|
|
|
|
|
|
|
environment =
|
2019-05-24 00:21:57 +01:00
|
|
|
|
optionalAttrs config.hardware.opengl.setLdLibraryPath
|
|
|
|
|
{ LD_LIBRARY_PATH = pkgs.addOpenGLRunpath.driverLink; }
|
|
|
|
|
// cfg.displayManager.job.environment;
|
2009-09-10 13:37:33 +01:00
|
|
|
|
|
|
|
|
|
preStart =
|
|
|
|
|
''
|
2009-09-10 16:49:16 +01:00
|
|
|
|
${cfg.displayManager.job.preStart}
|
2009-09-10 13:37:33 +01:00
|
|
|
|
|
|
|
|
|
rm -f /tmp/.X0-lock
|
|
|
|
|
'';
|
|
|
|
|
|
2009-09-13 16:03:07 +01:00
|
|
|
|
script = "${cfg.displayManager.job.execCmd}";
|
2013-10-15 12:15:33 +01:00
|
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Restart = "always";
|
|
|
|
|
RestartSec = "200ms";
|
2016-05-24 20:07:26 +01:00
|
|
|
|
SyslogIdentifier = "display-manager";
|
2016-10-10 21:35:37 +01:00
|
|
|
|
# Stop restarting if the display manager stops (crashes) 2 times
|
|
|
|
|
# in one minute. Starting X typically takes 3-4s.
|
|
|
|
|
StartLimitInterval = "30s";
|
|
|
|
|
StartLimitBurst = "3";
|
2013-10-15 12:15:33 +01:00
|
|
|
|
};
|
2009-09-10 13:37:33 +01:00
|
|
|
|
};
|
|
|
|
|
|
2016-10-28 17:15:40 +01:00
|
|
|
|
services.xserver.displayManager.xserverArgs =
|
2016-12-04 21:30:42 +00:00
|
|
|
|
[ "-config ${configFile}"
|
2015-12-24 12:30:42 +00:00
|
|
|
|
"-xkbdir" "${cfg.xkbDir}"
|
2016-05-24 20:07:26 +01:00
|
|
|
|
# Log at the default verbosity level to stderr rather than /var/log/X.*.log.
|
2017-05-07 22:01:20 +01:00
|
|
|
|
"-logfile" "/dev/null"
|
2016-10-28 17:15:40 +01:00
|
|
|
|
] ++ optional (cfg.display != null) ":${toString cfg.display}"
|
|
|
|
|
++ optional (cfg.tty != null) "vt${toString cfg.tty}"
|
2016-04-09 02:53:42 +01:00
|
|
|
|
++ optional (cfg.dpi != null) "-dpi ${toString cfg.dpi}"
|
2017-05-07 22:01:20 +01:00
|
|
|
|
++ optional (cfg.verbose != null) "-verbose ${toString cfg.verbose}"
|
2016-10-28 17:15:40 +01:00
|
|
|
|
++ optional (!cfg.enableTCP) "-nolisten tcp"
|
2016-10-01 20:44:58 +01:00
|
|
|
|
++ optional (cfg.autoRepeatDelay != null) "-ardelay ${toString cfg.autoRepeatDelay}"
|
2016-12-04 21:30:42 +00:00
|
|
|
|
++ optional (cfg.autoRepeatInterval != null) "-arinterval ${toString cfg.autoRepeatInterval}"
|
|
|
|
|
++ optional cfg.terminateOnReset "-terminate";
|
2009-09-10 13:37:33 +01:00
|
|
|
|
|
2009-11-06 00:59:03 +00:00
|
|
|
|
services.xserver.modules =
|
2014-04-29 13:16:34 +01:00
|
|
|
|
concatLists (catAttrs "modules" cfg.drivers) ++
|
2015-11-25 08:47:56 +00:00
|
|
|
|
[ xorg.xorgserver.out
|
2016-05-23 12:00:21 +01:00
|
|
|
|
xorg.xf86inputevdev.out
|
2009-11-06 00:59:03 +00:00
|
|
|
|
];
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
nixos/xserver: Properly validate XKB options
Checking the keyboard layout has been a long set of hurdles so far, with
several attempts. Originally, the checking was introduced by @lheckemann
in #23709.
The initial implementation just was trying to check whether the symbols/
directory contained the layout name.
Unfortunately, that wasn't enough and keyboard variants weren't
recognized, so if you set layout to eg. "dvorak" it will fail with an
error (#25526).
So my improvement on that was to use sed to filter rules/base.lst and
match the layout against that. I fucked up twice with this, first
because layout can be a comma-separated list which I didn't account for
and second because I ran into a Nix issue (NixOS/nix#1426).
After fixing this, it still wasn't enough (and this is btw. what
localectl also does), because we were *only* matching rules but not
symbols, so using "eu" as a layout won't work either.
I decided now it's the time to actually use libxkbcommon to try
compiling the keyboard options and see whether it succeeds. This comes
in the form of a helper tool called xkbvalidate.
IMHO this approach is a lot less error-prone and we can be sure that we
don't forget about anything because that's what the X server itself uses
to compile the keymap.
Another advantage of this is that we now validate the full set of XKB
options rather than just the layout.
Tested this against a variety of wrong and correct keyboard
configurations and against the "keymap" NixOS VM tests.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @lheckemann, @peti, @7c6f434c, @tohl, @vcunat, @lluchs
Fixes: #27597
2017-07-28 11:36:48 +01:00
|
|
|
|
system.extraDependencies = singleton (pkgs.runCommand "xkb-validated" {
|
|
|
|
|
inherit (cfg) xkbModel layout xkbVariant xkbOptions;
|
|
|
|
|
nativeBuildInputs = [ pkgs.xkbvalidate ];
|
2018-11-08 10:59:03 +00:00
|
|
|
|
preferLocalBuild = true;
|
2017-06-22 02:22:48 +01:00
|
|
|
|
} ''
|
2019-08-15 00:11:32 +01:00
|
|
|
|
xkbvalidate "$xkbModel" "$layout" "$xkbVariant" "$xkbOptions"
|
2017-07-03 07:14:19 +01:00
|
|
|
|
touch "$out"
|
2017-06-22 02:22:48 +01:00
|
|
|
|
'');
|
2017-03-23 20:06:52 +00:00
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
services.xserver.config =
|
|
|
|
|
''
|
|
|
|
|
Section "ServerFlags"
|
|
|
|
|
Option "AllowMouseOpenFail" "on"
|
2015-11-23 14:45:26 +00:00
|
|
|
|
Option "DontZap" "${if cfg.enableCtrlAltBackspace then "off" else "on"}"
|
2013-11-04 14:45:05 +00:00
|
|
|
|
${cfg.serverFlagsSection}
|
2009-09-10 13:37:33 +01:00
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
Section "Module"
|
|
|
|
|
${cfg.moduleSection}
|
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
Section "Monitor"
|
2009-11-06 00:59:03 +00:00
|
|
|
|
Identifier "Monitor[0]"
|
2009-09-10 13:37:33 +01:00
|
|
|
|
${cfg.monitorSection}
|
|
|
|
|
EndSection
|
|
|
|
|
|
2015-04-18 18:52:15 +01:00
|
|
|
|
# Additional "InputClass" sections
|
2015-04-12 22:49:48 +01:00
|
|
|
|
${flip concatMapStrings cfg.inputClassSections (inputClassSection: ''
|
|
|
|
|
Section "InputClass"
|
|
|
|
|
${inputClassSection}
|
|
|
|
|
EndSection
|
|
|
|
|
'')}
|
|
|
|
|
|
|
|
|
|
|
2009-09-10 13:37:33 +01:00
|
|
|
|
Section "ServerLayout"
|
2009-11-06 00:59:03 +00:00
|
|
|
|
Identifier "Layout[all]"
|
2009-09-10 13:37:33 +01:00
|
|
|
|
${cfg.serverLayoutSection}
|
2009-11-06 00:59:03 +00:00
|
|
|
|
# Reference the Screen sections for each driver. This will
|
|
|
|
|
# cause the X server to try each in turn.
|
2019-08-14 17:37:03 +01:00
|
|
|
|
${flip concatMapStrings (filter (d: d.display) cfg.drivers) (d: ''
|
2009-11-06 00:59:03 +00:00
|
|
|
|
Screen "Screen-${d.name}[0]"
|
|
|
|
|
'')}
|
2009-09-10 13:37:33 +01:00
|
|
|
|
EndSection
|
|
|
|
|
|
2014-03-16 17:46:20 +00:00
|
|
|
|
${if cfg.useGlamor then ''
|
|
|
|
|
Section "Module"
|
|
|
|
|
Load "dri2"
|
|
|
|
|
Load "glamoregl"
|
|
|
|
|
EndSection
|
|
|
|
|
'' else ""}
|
|
|
|
|
|
2009-11-06 00:59:03 +00:00
|
|
|
|
# For each supported driver, add a "Device" and "Screen"
|
|
|
|
|
# section.
|
2014-04-29 13:16:34 +01:00
|
|
|
|
${flip concatMapStrings cfg.drivers (driver: ''
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
2009-11-06 00:59:03 +00:00
|
|
|
|
Section "Device"
|
|
|
|
|
Identifier "Device-${driver.name}[0]"
|
2014-04-29 13:16:34 +01:00
|
|
|
|
Driver "${driver.driverName or driver.name}"
|
2014-03-16 17:46:20 +00:00
|
|
|
|
${if cfg.useGlamor then ''Option "AccelMethod" "glamor"'' else ""}
|
2009-11-06 00:59:03 +00:00
|
|
|
|
${cfg.deviceSection}
|
2018-06-30 08:33:45 +01:00
|
|
|
|
${driver.deviceSection or ""}
|
2013-01-09 23:31:08 +00:00
|
|
|
|
${xrandrDeviceSection}
|
2009-11-06 00:59:03 +00:00
|
|
|
|
EndSection
|
2019-08-14 17:37:03 +01:00
|
|
|
|
${optionalString driver.display ''
|
|
|
|
|
|
|
|
|
|
Section "Screen"
|
|
|
|
|
Identifier "Screen-${driver.name}[0]"
|
|
|
|
|
Device "Device-${driver.name}[0]"
|
|
|
|
|
${optionalString (cfg.monitorSection != "") ''
|
|
|
|
|
Monitor "Monitor[0]"
|
|
|
|
|
''}
|
|
|
|
|
|
|
|
|
|
${cfg.screenSection}
|
|
|
|
|
${driver.screenSection or ""}
|
|
|
|
|
|
|
|
|
|
${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]
|
|
|
|
|
)}
|
2009-11-06 00:59:03 +00:00
|
|
|
|
|
2019-08-14 17:37:03 +01:00
|
|
|
|
EndSection
|
|
|
|
|
''}
|
2009-11-06 00:59:03 +00:00
|
|
|
|
'')}
|
2013-01-09 21:19:58 +00:00
|
|
|
|
|
2013-01-09 23:31:08 +00:00
|
|
|
|
${xrandrMonitorSections}
|
2018-06-30 08:33:45 +01:00
|
|
|
|
|
|
|
|
|
${cfg.extraConfig}
|
2009-09-10 13:37:33 +01:00
|
|
|
|
'';
|
|
|
|
|
|
2016-09-05 14:48:48 +01:00
|
|
|
|
fonts.enableDefaultFonts = mkDefault true;
|
|
|
|
|
|
2013-10-30 17:30:23 +00:00
|
|
|
|
};
|
2009-09-10 13:37:33 +01:00
|
|
|
|
|
2006-11-28 22:27:56 +00:00
|
|
|
|
}
|