2025-04-01 20:10:43 +02:00
|
|
|
|
{
|
|
|
|
|
config,
|
|
|
|
|
lib,
|
|
|
|
|
utils,
|
|
|
|
|
pkgs,
|
|
|
|
|
...
|
|
|
|
|
}:
|
2006-11-28 22:27:56 +00:00
|
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
|
with lib;
|
2009-05-24 18:28:30 +00: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 12:37:33 +00:00
|
|
|
|
xorg = pkgs.xorg;
|
|
|
|
|
|
2014-04-29 14:16:34 +02:00
|
|
|
|
# Map video driver names to driver packages. FIXME: move into card-specific modules.
|
2008-10-10 16:45:56 +00:00
|
|
|
|
knownVideoDrivers = {
|
2018-11-12 20:29:14 +01:00
|
|
|
|
# Alias so people can keep using "virtualbox" instead of "vboxvideo".
|
2025-04-01 20:10:43 +02:00
|
|
|
|
virtualbox = {
|
|
|
|
|
modules = [ xorg.xf86videovboxvideo ];
|
|
|
|
|
driverName = "vboxvideo";
|
|
|
|
|
};
|
2016-08-05 18:29:02 +02:00
|
|
|
|
|
2019-07-16 22:52:33 +02:00
|
|
|
|
# Alias so that "radeon" uses the xf86-video-ati driver.
|
2025-04-01 20:10:43 +02:00
|
|
|
|
radeon = {
|
|
|
|
|
modules = [ xorg.xf86videoati ];
|
|
|
|
|
driverName = "ati";
|
|
|
|
|
};
|
2019-07-16 22:52:33 +02:00
|
|
|
|
|
2016-08-05 18:29:02 +02:00
|
|
|
|
# modesetting does not have a xf86videomodesetting package as it is included in xorgserver
|
2025-04-01 20:10:43 +02:00
|
|
|
|
modesetting = { };
|
2008-10-10 16:45:56 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-08-27 10:00:49 +00:00
|
|
|
|
fontsForXServer =
|
2025-04-01 20:10:43 +02:00
|
|
|
|
config.fonts.packages
|
|
|
|
|
++
|
2008-08-27 10:00:49 +00: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.)
|
2025-04-01 20:10:43 +02:00
|
|
|
|
[
|
|
|
|
|
pkgs.xorg.fontadobe100dpi
|
2008-08-27 10:00:49 +00:00
|
|
|
|
pkgs.xorg.fontadobe75dpi
|
|
|
|
|
];
|
2009-06-25 23:29:49 +00:00
|
|
|
|
|
2017-04-24 11:08:33 +02:00
|
|
|
|
xrandrOptions = {
|
|
|
|
|
output = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
example = "DVI-0";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2022-08-02 03:39:32 +02:00
|
|
|
|
The output name of the monitor, as shown by
|
2022-08-05 19:39:00 +02:00
|
|
|
|
{manpage}`xrandr(1)` invoked without arguments.
|
2017-04-24 11:08:33 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
primary = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2017-04-24 11:08:33 +02:00
|
|
|
|
Whether this head is treated as the primary monitor,
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
monitorConfig = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = "";
|
|
|
|
|
example = ''
|
|
|
|
|
DisplaySize 408 306
|
|
|
|
|
Option "DPMS" "false"
|
|
|
|
|
'';
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2022-08-05 19:39:00 +02:00
|
|
|
|
Extra lines to append to the `Monitor` section
|
2019-03-01 00:44:19 +01:00
|
|
|
|
verbatim. Available options are documented in the MONITOR section in
|
2022-08-05 19:39:00 +02:00
|
|
|
|
{manpage}`xorg.conf(5)`.
|
2017-04-24 11:08:33 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
2013-01-24 13:06:32 +01:00
|
|
|
|
|
2013-01-10 00:31:08 +01:00
|
|
|
|
# Just enumerate all heads without discarding XRandR output information.
|
2025-04-01 20:10:43 +02:00
|
|
|
|
xrandrHeads =
|
|
|
|
|
let
|
|
|
|
|
mkHead = num: config: {
|
|
|
|
|
name = "multihead${toString num}";
|
|
|
|
|
inherit config;
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
imap1 mkHead cfg.xrandrHeads;
|
2013-01-10 00:31:08 +01:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
xrandrDeviceSection =
|
|
|
|
|
let
|
|
|
|
|
monitors = forEach xrandrHeads (h: ''
|
|
|
|
|
Option "monitor-${h.config.output}" "${h.name}"
|
|
|
|
|
'');
|
|
|
|
|
in
|
|
|
|
|
concatStrings monitors;
|
2013-01-10 00:31:08 +01: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 |
|
|
|
|
|
# `----^----^----^----'
|
2025-04-01 20:10:43 +02:00
|
|
|
|
xrandrMonitorSections =
|
|
|
|
|
let
|
|
|
|
|
mkMonitor =
|
|
|
|
|
previous: current:
|
|
|
|
|
singleton {
|
|
|
|
|
inherit (current) name;
|
|
|
|
|
value = ''
|
|
|
|
|
Section "Monitor"
|
|
|
|
|
Identifier "${current.name}"
|
|
|
|
|
${optionalString (current.config.primary) ''
|
|
|
|
|
Option "Primary" "true"
|
|
|
|
|
''}
|
|
|
|
|
${optionalString (previous != [ ]) ''
|
|
|
|
|
Option "RightOf" "${(head previous).name}"
|
|
|
|
|
''}
|
|
|
|
|
${current.config.monitorConfig}
|
|
|
|
|
EndSection
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
++ previous;
|
|
|
|
|
monitors = reverseList (foldl mkMonitor [ ] xrandrHeads);
|
|
|
|
|
in
|
|
|
|
|
concatMapStrings (getAttr "value") monitors;
|
|
|
|
|
|
|
|
|
|
configFile =
|
|
|
|
|
pkgs.runCommand "xserver.conf"
|
|
|
|
|
{
|
|
|
|
|
fontpath = optionalString (cfg.fontPath != null) ''FontPath "${cfg.fontPath}"'';
|
|
|
|
|
inherit (cfg) config;
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
}
|
2009-09-10 12:37:33 +00:00
|
|
|
|
''
|
|
|
|
|
echo 'Section "Files"' >> $out
|
2024-03-28 18:22:25 +01:00
|
|
|
|
echo "$fontpath" >> $out
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
|
|
|
|
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 18:20:50 +00:00
|
|
|
|
|
2024-03-28 18:22:25 +01:00
|
|
|
|
${concatMapStrings (m: ''
|
2025-04-01 20:10:43 +02:00
|
|
|
|
echo " ModulePath \"${m}/lib/xorg/modules\"" >> "$out"
|
2024-03-28 18:22:25 +01:00
|
|
|
|
'') cfg.modules}
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2020-09-01 10:37:11 +02:00
|
|
|
|
echo '${cfg.filesSection}' >> $out
|
2009-09-10 12:37:33 +00:00
|
|
|
|
echo 'EndSection' >> $out
|
2021-06-17 03:15:13 +02:00
|
|
|
|
echo >> $out
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
echo "$config" >> $out
|
|
|
|
|
''; # */
|
2006-11-28 22:27:56 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
prefixStringLines =
|
|
|
|
|
prefix: str: concatMapStringsSep "\n" (line: prefix + line) (splitString "\n" str);
|
2021-06-17 03:15:13 +02:00
|
|
|
|
|
|
|
|
|
indent = prefixStringLines " ";
|
2023-03-20 21:22:22 +03:00
|
|
|
|
|
|
|
|
|
# A scalable variant of the X11 "core" cursor
|
|
|
|
|
#
|
|
|
|
|
# If not running a fancy desktop environment, the cursor is likely set to
|
|
|
|
|
# the default `cursor.pcf` bitmap font. This is 17px wide, so it's very
|
|
|
|
|
# small and almost invisible on 4K displays.
|
2025-04-01 20:10:43 +02:00
|
|
|
|
fontcursormisc_hidpi = pkgs.xorg.fontxfree86type1.overrideAttrs (
|
|
|
|
|
old:
|
2023-03-20 21:22:22 +03:00
|
|
|
|
let
|
|
|
|
|
# The scaling constant is 230/96: the scalable `left_ptr` glyph at
|
|
|
|
|
# about 23 points is rendered as 17px, on a 96dpi display.
|
|
|
|
|
# Note: the XLFD font size is in decipoints.
|
|
|
|
|
size = 2.39583 * cfg.dpi;
|
|
|
|
|
sizeString = builtins.head (builtins.split "\\." (toString size));
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
postInstall = ''
|
|
|
|
|
alias='cursor -xfree86-cursor-medium-r-normal--0-${sizeString}-0-0-p-0-adobe-fontspecific'
|
|
|
|
|
echo "$alias" > $out/lib/X11/fonts/Type1/fonts.alias
|
|
|
|
|
'';
|
2025-04-01 20:10:43 +02:00
|
|
|
|
}
|
|
|
|
|
);
|
2009-01-02 16:07:21 +00:00
|
|
|
|
in
|
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
{
|
2009-05-15 07:51:51 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
imports = [
|
|
|
|
|
./display-managers/default.nix
|
|
|
|
|
./window-managers/default.nix
|
|
|
|
|
./desktop-managers/default.nix
|
|
|
|
|
(mkRemovedOptionModule [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"startGnuPGAgent"
|
|
|
|
|
] "See the 16.09 release notes for more information.")
|
|
|
|
|
(mkRemovedOptionModule [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"startDbusSession"
|
|
|
|
|
] "The user D-Bus session is now always socket activated and this option can safely be removed.")
|
|
|
|
|
(mkRemovedOptionModule [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"useXFS"
|
|
|
|
|
] "Use services.xserver.fontPath instead of useXFS")
|
|
|
|
|
(mkRemovedOptionModule [ "services" "xserver" "useGlamor" ]
|
|
|
|
|
"Option services.xserver.useGlamor was removed because it is unnecessary. Drivers that uses Glamor will use it automatically."
|
|
|
|
|
)
|
|
|
|
|
(lib.mkRenamedOptionModuleWith {
|
|
|
|
|
sinceRelease = 2311;
|
|
|
|
|
from = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"layout"
|
|
|
|
|
];
|
|
|
|
|
to = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkb"
|
|
|
|
|
"layout"
|
|
|
|
|
];
|
|
|
|
|
})
|
|
|
|
|
(lib.mkRenamedOptionModuleWith {
|
|
|
|
|
sinceRelease = 2311;
|
|
|
|
|
from = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkbModel"
|
|
|
|
|
];
|
|
|
|
|
to = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkb"
|
|
|
|
|
"model"
|
|
|
|
|
];
|
|
|
|
|
})
|
|
|
|
|
(lib.mkRenamedOptionModuleWith {
|
|
|
|
|
sinceRelease = 2311;
|
|
|
|
|
from = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkbOptions"
|
|
|
|
|
];
|
|
|
|
|
to = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkb"
|
|
|
|
|
"options"
|
|
|
|
|
];
|
|
|
|
|
})
|
|
|
|
|
(lib.mkRenamedOptionModuleWith {
|
|
|
|
|
sinceRelease = 2311;
|
|
|
|
|
from = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkbVariant"
|
|
|
|
|
];
|
|
|
|
|
to = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkb"
|
|
|
|
|
"variant"
|
|
|
|
|
];
|
|
|
|
|
})
|
|
|
|
|
(lib.mkRenamedOptionModuleWith {
|
|
|
|
|
sinceRelease = 2311;
|
|
|
|
|
from = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkbDir"
|
|
|
|
|
];
|
|
|
|
|
to = [
|
|
|
|
|
"services"
|
|
|
|
|
"xserver"
|
|
|
|
|
"xkb"
|
|
|
|
|
"dir"
|
|
|
|
|
];
|
|
|
|
|
})
|
|
|
|
|
];
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
###### interface
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
options = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
services.xserver = {
|
|
|
|
|
|
|
|
|
|
enable = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.bool;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2009-09-10 12:37:33 +00:00
|
|
|
|
Whether to enable the X server.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
autorun = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.bool;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = true;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2009-09-10 12:37:33 +00:00
|
|
|
|
Whether to start the X server automatically.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2022-04-11 01:09:36 +02:00
|
|
|
|
excludePackages = mkOption {
|
2025-04-01 20:10:43 +02:00
|
|
|
|
default = [ ];
|
2022-04-11 01:09:36 +02:00
|
|
|
|
example = literalExpression "[ pkgs.xterm ]";
|
|
|
|
|
type = types.listOf types.package;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Which X11 packages to exclude from the default environment";
|
2022-04-11 01:09:36 +02:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
exportConfiguration = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.bool;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2009-09-10 12:37:33 +00:00
|
|
|
|
Whether to symlink the X server configuration under
|
2022-08-05 19:39:00 +02:00
|
|
|
|
{file}`/etc/X11/xorg.conf`.
|
2009-09-10 12:37:33 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
enableTCP = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.bool;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2009-09-10 12:37:33 +00:00
|
|
|
|
Whether to allow the X server to accept TCP connections.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:39 +00:00
|
|
|
|
|
2016-10-01 15:44:58 -04:00
|
|
|
|
autoRepeatDelay = mkOption {
|
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
|
default = null;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2016-10-01 15:44:58 -04:00
|
|
|
|
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;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2016-10-01 15:44:58 -04:00
|
|
|
|
Sets the autorepeat interval (length of time in milliseconds that should elapse between autorepeat-generated keystrokes).
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-04-12 23:49:48 +02:00
|
|
|
|
inputClassSections = mkOption {
|
|
|
|
|
type = types.listOf types.lines;
|
2025-04-01 20:10:43 +02:00
|
|
|
|
default = [ ];
|
2021-10-03 18:06:03 +02:00
|
|
|
|
example = literalExpression ''
|
2015-07-04 18:52:50 +12:00
|
|
|
|
[ '''
|
|
|
|
|
Identifier "Trackpoint Wheel Emulation"
|
|
|
|
|
MatchProduct "ThinkPad USB Keyboard with TrackPoint"
|
2016-03-18 10:25:37 +01:00
|
|
|
|
Option "EmulateWheel" "true"
|
2015-07-04 18:52:50 +12:00
|
|
|
|
Option "EmulateWheelButton" "2"
|
|
|
|
|
Option "Emulate3Buttons" "false"
|
|
|
|
|
'''
|
|
|
|
|
]
|
|
|
|
|
'';
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Content of additional InputClass sections of the X server configuration file.";
|
2015-04-12 23:49:48 +02:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
modules = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.listOf types.path;
|
2025-04-01 20:10:43 +02:00
|
|
|
|
default = [ ];
|
2021-10-03 18:06:03 +02:00
|
|
|
|
example = literalExpression "[ pkgs.xf86_input_wacom ]";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Packages to be added to the module search path of the X server.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
resolutions = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.listOf types.attrs;
|
2025-04-01 20:10:43 +02:00
|
|
|
|
default = [ ];
|
|
|
|
|
example = [
|
|
|
|
|
{
|
|
|
|
|
x = 1600;
|
|
|
|
|
y = 1200;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
x = 1024;
|
|
|
|
|
y = 786;
|
|
|
|
|
}
|
|
|
|
|
];
|
2024-04-13 14:54:15 +02: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 12:37:33 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2014-04-29 12:58:54 +02:00
|
|
|
|
videoDrivers = mkOption {
|
|
|
|
|
type = types.listOf types.str;
|
2025-04-01 20:10:43 +02:00
|
|
|
|
default = [
|
|
|
|
|
"modesetting"
|
|
|
|
|
"fbdev"
|
|
|
|
|
];
|
2018-04-25 07:12:04 +00:00
|
|
|
|
example = [
|
2024-03-25 16:56:11 +01:00
|
|
|
|
"nvidia"
|
2024-06-16 13:39:52 +03:00
|
|
|
|
"amdgpu"
|
2018-04-25 07:12:04 +00:00
|
|
|
|
];
|
2018-04-25 07:12:04 +00:00
|
|
|
|
# TODO(@oxij): think how to easily add the rest, like those nvidia things
|
2025-04-01 20:10:43 +02:00
|
|
|
|
relatedPackages = concatLists (
|
|
|
|
|
mapAttrsToList (
|
|
|
|
|
n: v:
|
2018-04-25 07:12:04 +00:00
|
|
|
|
optional (hasPrefix "xf86video" n) {
|
2025-04-01 20:10:43 +02:00
|
|
|
|
path = [
|
|
|
|
|
"xorg"
|
|
|
|
|
n
|
|
|
|
|
];
|
2018-04-25 07:12:04 +00:00
|
|
|
|
title = removePrefix "xf86video" n;
|
2025-04-01 20:10:43 +02:00
|
|
|
|
}
|
|
|
|
|
) pkgs.xorg
|
|
|
|
|
);
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2014-04-29 12:58:54 +02:00
|
|
|
|
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 13:59:48 +01: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 12:58:54 +02:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
videoDriver = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.nullOr types.str;
|
2009-11-06 00:59:03 +00:00
|
|
|
|
default = null;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
example = "i810";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
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
|
2022-08-05 19:39:00 +02:00
|
|
|
|
{option}`services.xserver.videoDrivers` instead.
|
2009-09-10 12:37:33 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-01-02 16:07:21 +00:00
|
|
|
|
|
2014-04-29 14:16:34 +02:00
|
|
|
|
drivers = mkOption {
|
|
|
|
|
type = types.listOf types.attrs;
|
|
|
|
|
internal = true;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2014-04-29 14:16:34 +02:00
|
|
|
|
A list of attribute sets specifying drivers to be loaded by
|
|
|
|
|
the X11 server.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2016-04-08 18:53:42 -07:00
|
|
|
|
dpi = mkOption {
|
|
|
|
|
type = types.nullOr types.int;
|
2016-04-10 17:46:17 +02:00
|
|
|
|
default = null;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2017-05-24 17:25:19 +03:00
|
|
|
|
Force global DPI resolution to use for X server. It's recommended to
|
|
|
|
|
use this only when DPI is detected incorrectly; also consider using
|
2022-08-05 19:39:00 +02:00
|
|
|
|
`Monitor` section in configuration file instead.
|
2017-05-24 17:25:19 +03:00
|
|
|
|
'';
|
2016-04-08 18:53:42 -07:00
|
|
|
|
};
|
|
|
|
|
|
2016-04-25 23:37:18 +02:00
|
|
|
|
updateDbusEnvironment = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2016-04-25 23:37:18 +02:00
|
|
|
|
Whether to update the DBus activation environment after launching the
|
|
|
|
|
desktop manager.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-14 04:15:53 +03:00
|
|
|
|
xkb = {
|
|
|
|
|
layout = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
default = "us";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2023-10-14 04:15:53 +03:00
|
|
|
|
X keyboard layout, or multiple keyboard layouts separated by commas.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
model = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
default = "pc104";
|
|
|
|
|
example = "presario";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2023-10-14 04:15:53 +03:00
|
|
|
|
X keyboard model.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
options = mkOption {
|
|
|
|
|
type = types.commas;
|
|
|
|
|
default = "terminate:ctrl_alt_bksp";
|
|
|
|
|
example = "grp:caps_toggle,grp_led:scroll";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2023-10-14 04:15:53 +03:00
|
|
|
|
X keyboard options; layout switching goes here.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
variant = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
default = "";
|
|
|
|
|
example = "colemak";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2023-10-14 04:15:53 +03:00
|
|
|
|
X keyboard variant.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dir = mkOption {
|
|
|
|
|
type = types.path;
|
|
|
|
|
default = "${pkgs.xkeyboard_config}/etc/X11/xkb";
|
|
|
|
|
defaultText = literalExpression ''"''${pkgs.xkeyboard_config}/etc/X11/xkb"'';
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2023-10-14 04:15:53 +03:00
|
|
|
|
Path used for -xkbdir xserver parameter.
|
|
|
|
|
'';
|
2023-10-09 14:31:13 +13:00
|
|
|
|
};
|
2015-12-24 13:30:42 +01:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
config = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.lines;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2009-09-10 12:37:33 +00:00
|
|
|
|
The contents of the configuration file of the X server
|
2022-08-05 19:39:00 +02:00
|
|
|
|
({file}`xorg.conf`).
|
2021-06-17 04:06:26 +02:00
|
|
|
|
|
|
|
|
|
This option is set by multiple modules, and the configs are
|
|
|
|
|
concatenated together.
|
|
|
|
|
|
|
|
|
|
In Xorg configs the last config entries take precedence,
|
2022-08-05 19:39:00 +02:00
|
|
|
|
so you may want to use `lib.mkAfter` on this option
|
2021-06-17 04:06:26 +02:00
|
|
|
|
to override NixOS's defaults.
|
2009-09-10 12:37:33 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
2009-06-03 08:14:54 +00:00
|
|
|
|
|
2020-09-01 10:37:11 +02:00
|
|
|
|
filesSection = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = "";
|
|
|
|
|
example = ''FontPath "/path/to/my/fonts"'';
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Contents of the first `Files` section of the X server configuration file.";
|
2020-09-01 10:37:11 +02:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
deviceSection = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.lines;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = "";
|
|
|
|
|
example = "VideoRAM 131072";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Contents of the first Device section of the X server configuration file.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2010-05-08 17:18:22 +00:00
|
|
|
|
screenSection = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.lines;
|
2010-05-08 17:18:22 +00:00
|
|
|
|
default = "";
|
|
|
|
|
example = ''
|
|
|
|
|
Option "RandRRotation" "on"
|
|
|
|
|
'';
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Contents of the first Screen section of the X server configuration file.";
|
2010-05-08 17:18:22 +00:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
monitorSection = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.lines;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = "";
|
|
|
|
|
example = "HorizSync 28-49";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Contents of the first Monitor section of the X server configuration file.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
2009-04-08 13:41:33 +00:00
|
|
|
|
|
2024-05-04 15:36:36 +03:00
|
|
|
|
enableTearFree = mkEnableOption "the TearFree option in the first Device section";
|
|
|
|
|
|
2018-06-30 09:33:45 +02:00
|
|
|
|
extraConfig = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = "";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Additional contents (sections) included in the X server configuration file";
|
2018-06-30 09:33:45 +02:00
|
|
|
|
};
|
|
|
|
|
|
2013-01-10 00:31:08 +01:00
|
|
|
|
xrandrHeads = mkOption {
|
2025-04-01 20:10:43 +02:00
|
|
|
|
default = [ ];
|
2017-04-24 11:08:33 +02:00
|
|
|
|
example = [
|
|
|
|
|
"HDMI-0"
|
2025-04-01 20:10:43 +02:00
|
|
|
|
{
|
|
|
|
|
output = "DVI-0";
|
|
|
|
|
primary = true;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
output = "DVI-1";
|
|
|
|
|
monitorConfig = "Option \"Rotate\" \"left\"";
|
|
|
|
|
}
|
2017-04-24 11:08:33 +02:00
|
|
|
|
];
|
2025-04-01 20:10:43 +02:00
|
|
|
|
type =
|
|
|
|
|
with types;
|
|
|
|
|
listOf (
|
|
|
|
|
coercedTo str
|
|
|
|
|
(output: {
|
|
|
|
|
inherit output;
|
|
|
|
|
})
|
|
|
|
|
(submodule {
|
|
|
|
|
options = xrandrOptions;
|
|
|
|
|
})
|
|
|
|
|
);
|
2017-04-24 12:02:10 +02:00
|
|
|
|
# Set primary to true for the first head if no other has been set
|
|
|
|
|
# primary already.
|
2025-04-01 20:10:43 +02: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;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2017-04-24 11:08:33 +02: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-15 00:00:55 +11:00
|
|
|
|
|
2017-04-24 11:08:33 +02: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
|
2022-08-30 02:30:04 +02:00
|
|
|
|
{option}`output` option.
|
2016-03-15 00:00:55 +11:00
|
|
|
|
|
2017-04-24 11:08:33 +02:00
|
|
|
|
The monitors will be mapped from left to right in the order of the
|
2013-01-10 00:31:08 +01:00
|
|
|
|
list.
|
|
|
|
|
|
2017-04-24 11:08:33 +02:00
|
|
|
|
By default, the first monitor will be set as the primary monitor if
|
|
|
|
|
none of the elements contain an option that has set
|
2022-08-30 02:30:04 +02:00
|
|
|
|
{option}`primary` to `true`.
|
2017-04-24 11:08:33 +02:00
|
|
|
|
|
2022-08-30 02:30:04 +02:00
|
|
|
|
::: {.note}
|
|
|
|
|
Only one monitor is allowed to be primary.
|
|
|
|
|
:::
|
2013-01-10 00:31:08 +01: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 18:45:05 +04:00
|
|
|
|
serverFlagsSection = mkOption {
|
|
|
|
|
default = "";
|
2021-01-31 12:53:41 +01:00
|
|
|
|
type = types.lines;
|
2025-04-01 20:10:43 +02:00
|
|
|
|
example = ''
|
2013-11-04 18:45:05 +04:00
|
|
|
|
Option "BlankTime" "0"
|
|
|
|
|
Option "StandbyTime" "0"
|
|
|
|
|
Option "SuspendTime" "0"
|
|
|
|
|
Option "OffTime" "0"
|
2025-04-01 20:10:43 +02:00
|
|
|
|
'';
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Contents of the ServerFlags section of the X server configuration file.";
|
2013-11-04 18:45:05 +04:00
|
|
|
|
};
|
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
moduleSection = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.lines;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = "";
|
2025-04-01 20:10:43 +02:00
|
|
|
|
example = ''
|
|
|
|
|
SubSection "extmod"
|
|
|
|
|
EndSubsection
|
|
|
|
|
'';
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Contents of the Module section of the X server configuration file.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
2009-04-08 13:41:33 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
serverLayoutSection = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.lines;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = "";
|
2025-04-01 20:10:43 +02:00
|
|
|
|
example = ''
|
|
|
|
|
Option "AIGLX" "true"
|
|
|
|
|
'';
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Contents of the ServerLayout section of the X server configuration file.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
extraDisplaySettings = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.lines;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = "";
|
|
|
|
|
example = "Virtual 2048 2048";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Lines to be added to every Display subsection of the Screen section.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2009-09-10 12:37:33 +00:00
|
|
|
|
defaultDepth = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.int;
|
2009-11-06 00:59:03 +00:00
|
|
|
|
default = 0;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
example = 8;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Default colour depth.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
2020-04-27 10:51:23 +02:00
|
|
|
|
fontPath = mkOption {
|
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = null;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
example = "unix/:7100";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2020-04-27 10:51:23 +02:00
|
|
|
|
Set the X server FontPath. Defaults to null, which
|
|
|
|
|
means the compiled in defaults will be used. See
|
|
|
|
|
man xorg.conf for details.
|
|
|
|
|
'';
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
tty = mkOption {
|
2015-11-29 00:18:59 +00:00
|
|
|
|
type = types.nullOr types.int;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = 7;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Virtual console for the X server.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
display = mkOption {
|
2015-11-29 00:18:59 +00:00
|
|
|
|
type = types.nullOr types.int;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = 0;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = "Display number for the X server.";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtualScreen = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
|
type = types.nullOr types.attrs;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
default = null;
|
2025-04-01 20:10:43 +02:00
|
|
|
|
example = {
|
|
|
|
|
x = 2048;
|
|
|
|
|
y = 2048;
|
|
|
|
|
};
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2009-09-10 12:37:33 +00:00
|
|
|
|
Virtual screen size for Xrandr.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2020-02-15 22:53:56 +01:00
|
|
|
|
logFile = mkOption {
|
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = "/dev/null";
|
|
|
|
|
example = "/var/log/Xorg.0.log";
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2020-02-15 22:53:56 +01:00
|
|
|
|
Controls the file Xorg logs to.
|
|
|
|
|
|
2022-08-05 19:39:00 +02:00
|
|
|
|
The default of `/dev/null` is set so that systemd services (like `displayManagers`) only log to the journal and don't create their own log files.
|
2020-02-15 22:53:56 +01:00
|
|
|
|
|
2022-08-05 19:39:00 +02:00
|
|
|
|
Setting this to `null` will not pass the `-logfile` argument to Xorg which allows it to log to its default logfile locations instead (see `man Xorg`). You probably only want this behaviour when running Xorg manually (e.g. via `startx`).
|
2020-02-15 22:53:56 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2017-05-07 23:01:20 +02:00
|
|
|
|
verbose = mkOption {
|
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
|
default = 3;
|
|
|
|
|
example = 7;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2017-05-07 23:01:20 +02:00
|
|
|
|
Controls verbosity of X logging.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2015-11-23 14:45:26 +00:00
|
|
|
|
enableCtrlAltBackspace = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2015-11-23 14:45:26 +00:00
|
|
|
|
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 22:30:42 +01:00
|
|
|
|
|
|
|
|
|
terminateOnReset = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2016-12-04 22:30:42 +01:00
|
|
|
|
Whether to terminate X upon server reset.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2023-03-20 21:22:22 +03:00
|
|
|
|
|
|
|
|
|
upscaleDefaultCursor = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
|
description = ''
|
2023-03-20 21:22:22 +03:00
|
|
|
|
Upscale the default X cursor to be more visible on high-density displays.
|
|
|
|
|
Requires `config.services.xserver.dpi` to be set.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
###### implementation
|
2009-11-21 22:14:01 +00:00
|
|
|
|
|
2013-10-30 18:30:23 +01:00
|
|
|
|
config = mkIf cfg.enable {
|
2024-02-27 10:06:13 +01:00
|
|
|
|
services.displayManager.enable = true;
|
2014-04-29 14:16:34 +02:00
|
|
|
|
|
2018-08-20 14:25:25 +02:00
|
|
|
|
services.xserver.displayManager.lightdm.enable =
|
2025-04-01 20:10:43 +02:00
|
|
|
|
let
|
|
|
|
|
dmConf = cfg.displayManager;
|
|
|
|
|
default =
|
|
|
|
|
!(
|
2025-05-28 14:27:36 +03:00
|
|
|
|
config.services.displayManager.gdm.enable
|
2025-04-01 20:10:43 +02:00
|
|
|
|
|| config.services.displayManager.sddm.enable
|
|
|
|
|
|| dmConf.xpra.enable
|
|
|
|
|
|| dmConf.sx.enable
|
|
|
|
|
|| dmConf.startx.enable
|
|
|
|
|
|| config.services.greetd.enable
|
|
|
|
|
|| config.services.displayManager.ly.enable
|
|
|
|
|
);
|
|
|
|
|
in
|
|
|
|
|
mkIf (default) (mkDefault true);
|
2021-07-25 06:43:59 +03:00
|
|
|
|
|
2014-04-29 12:58:54 +02:00
|
|
|
|
services.xserver.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
|
2013-10-30 18:30:23 +01:00
|
|
|
|
|
2016-08-06 07:22:33 +02:00
|
|
|
|
# FIXME: somehow check for unknown driver names.
|
2025-04-01 20:10:43 +02:00
|
|
|
|
services.xserver.drivers = flip concatMap cfg.videoDrivers (
|
|
|
|
|
name:
|
|
|
|
|
let
|
|
|
|
|
driver = attrByPath [ name ] (
|
|
|
|
|
if xorg ? ${"xf86video" + name} then { modules = [ xorg.${"xf86video" + name} ]; } else null
|
|
|
|
|
) knownVideoDrivers;
|
|
|
|
|
in
|
|
|
|
|
optional (driver != null) (
|
|
|
|
|
{
|
|
|
|
|
inherit name;
|
|
|
|
|
modules = [ ];
|
|
|
|
|
driverName = name;
|
|
|
|
|
display = true;
|
|
|
|
|
}
|
|
|
|
|
// driver
|
|
|
|
|
)
|
|
|
|
|
);
|
2014-04-29 14:16:34 +02:00
|
|
|
|
|
2017-04-24 11:08:33 +02:00
|
|
|
|
assertions = [
|
2025-04-01 20:10:43 +02:00
|
|
|
|
(
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-03-20 21:22:22 +03:00
|
|
|
|
{
|
|
|
|
|
assertion = cfg.upscaleDefaultCursor -> cfg.dpi != null;
|
|
|
|
|
message = "Specify `config.services.xserver.dpi` to upscale the default cursor.";
|
|
|
|
|
}
|
2017-04-24 11:08:33 +02:00
|
|
|
|
];
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2017-01-30 14:03:42 +01:00
|
|
|
|
environment.etc =
|
2025-04-01 20:10:43 +02:00
|
|
|
|
(optionalAttrs cfg.exportConfiguration {
|
|
|
|
|
"X11/xorg.conf".source = "${configFile}";
|
|
|
|
|
# -xkbdir command line option does not seems to be passed to xkbcomp.
|
|
|
|
|
"X11/xkb".source = "${cfg.xkb.dir}";
|
|
|
|
|
})
|
2016-05-23 13:01:01 +02:00
|
|
|
|
# Needed since 1.18; see https://bugs.freedesktop.org/show_bug.cgi?id=89023#c5
|
2025-04-01 20:10:43 +02:00
|
|
|
|
// (
|
|
|
|
|
let
|
|
|
|
|
cfgPath = "X11/xorg.conf.d/10-evdev.conf";
|
|
|
|
|
in
|
2019-09-14 19:51:29 +02:00
|
|
|
|
{
|
2024-01-28 13:38:09 +01:00
|
|
|
|
${cfgPath}.source = xorg.xf86inputevdev.out + "/share/" + cfgPath;
|
2025-04-01 20:10:43 +02:00
|
|
|
|
}
|
|
|
|
|
);
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
environment.systemPackages =
|
|
|
|
|
utils.removePackagesByName [
|
|
|
|
|
xorg.xorgserver.out
|
2009-09-10 12:37:33 +00: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 12:37:33 +00:00
|
|
|
|
xorg.xsetroot
|
2013-04-27 03:30:40 +02:00
|
|
|
|
xorg.xinput
|
2009-09-13 13:26:35 +00:00
|
|
|
|
xorg.xprop
|
2016-04-12 19:12:47 +02:00
|
|
|
|
xorg.xauth
|
2010-02-10 13:22:38 +00:00
|
|
|
|
pkgs.xterm
|
2016-05-23 13:01:01 +02:00
|
|
|
|
xorg.xf86inputevdev.out # get evdev.4 man page
|
2022-04-11 01:09:36 +02:00
|
|
|
|
] config.services.xserver.excludePackages
|
2014-09-05 19:53:36 +10:00
|
|
|
|
++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh;
|
2014-03-17 19:27:06 +01:00
|
|
|
|
|
2018-09-06 01:04:40 +02:00
|
|
|
|
environment.pathsToLink = [ "/share/X11" ];
|
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
systemd.services.display-manager = {
|
|
|
|
|
description = "Display Manager";
|
2013-01-10 13:59:41 +01:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
after = [
|
|
|
|
|
"acpid.service"
|
|
|
|
|
"systemd-logind.service"
|
|
|
|
|
"systemd-user-sessions.service"
|
|
|
|
|
];
|
2011-09-14 18:20:50 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
restartIfChanged = false;
|
2012-03-18 02:10:39 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
environment = config.services.displayManager.environment;
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
preStart = ''
|
|
|
|
|
${config.services.displayManager.preStart}
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
rm -f /tmp/.X0-lock
|
|
|
|
|
'';
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
# Stop restarting if the display manager stops (crashes) 2 times
|
|
|
|
|
# in one minute. Starting X typically takes 3-4s.
|
|
|
|
|
startLimitIntervalSec = 30;
|
|
|
|
|
startLimitBurst = 3;
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Restart = "always";
|
|
|
|
|
RestartSec = "200ms";
|
|
|
|
|
SyslogIdentifier = "display-manager";
|
2009-09-10 12:37:33 +00:00
|
|
|
|
};
|
2025-04-01 20:10:43 +02:00
|
|
|
|
};
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2016-10-28 18:15:40 +02:00
|
|
|
|
services.xserver.displayManager.xserverArgs =
|
2025-04-01 20:10:43 +02:00
|
|
|
|
[
|
|
|
|
|
"-config ${configFile}"
|
|
|
|
|
"-xkbdir"
|
|
|
|
|
"${cfg.xkb.dir}"
|
|
|
|
|
]
|
|
|
|
|
++ optional (cfg.display != null) ":${toString cfg.display}"
|
|
|
|
|
++ optional (cfg.tty != null) "vt${toString cfg.tty}"
|
|
|
|
|
++ optional (cfg.dpi != null) "-dpi ${toString cfg.dpi}"
|
|
|
|
|
++ optional (cfg.logFile != null) "-logfile ${toString cfg.logFile}"
|
|
|
|
|
++ optional (cfg.verbose != null) "-verbose ${toString cfg.verbose}"
|
|
|
|
|
++ optional (!cfg.enableTCP) "-nolisten tcp"
|
|
|
|
|
++ optional (cfg.autoRepeatDelay != null) "-ardelay ${toString cfg.autoRepeatDelay}"
|
|
|
|
|
++ optional (cfg.autoRepeatInterval != null) "-arinterval ${toString cfg.autoRepeatInterval}"
|
|
|
|
|
++ optional cfg.terminateOnReset "-terminate";
|
|
|
|
|
|
|
|
|
|
services.xserver.modules = concatLists (catAttrs "modules" cfg.drivers) ++ [
|
|
|
|
|
xorg.xorgserver.out
|
|
|
|
|
xorg.xf86inputevdev.out
|
|
|
|
|
];
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
system.checks = singleton (
|
|
|
|
|
pkgs.runCommand "xkb-validated"
|
|
|
|
|
{
|
|
|
|
|
inherit (cfg.xkb)
|
|
|
|
|
dir
|
|
|
|
|
model
|
|
|
|
|
layout
|
|
|
|
|
variant
|
|
|
|
|
options
|
|
|
|
|
;
|
|
|
|
|
nativeBuildInputs = with pkgs.buildPackages; [ xkbvalidate ];
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
}
|
|
|
|
|
''
|
|
|
|
|
${optionalString (
|
|
|
|
|
config.environment.sessionVariables ? XKB_CONFIG_ROOT
|
|
|
|
|
) "export XKB_CONFIG_ROOT=${config.environment.sessionVariables.XKB_CONFIG_ROOT}"}
|
|
|
|
|
XKB_CONFIG_ROOT="$dir" xkbvalidate "$model" "$layout" "$variant" "$options"
|
|
|
|
|
touch "$out"
|
|
|
|
|
''
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
services.xserver.config = ''
|
|
|
|
|
Section "ServerFlags"
|
|
|
|
|
Option "AllowMouseOpenFail" "on"
|
|
|
|
|
Option "DontZap" "${if cfg.enableCtrlAltBackspace then "off" else "on"}"
|
|
|
|
|
${indent cfg.serverFlagsSection}
|
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
Section "Module"
|
|
|
|
|
${indent cfg.moduleSection}
|
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
Section "Monitor"
|
|
|
|
|
Identifier "Monitor[0]"
|
|
|
|
|
${indent cfg.monitorSection}
|
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
# Additional "InputClass" sections
|
|
|
|
|
${flip (concatMapStringsSep "\n") cfg.inputClassSections (inputClassSection: ''
|
|
|
|
|
Section "InputClass"
|
|
|
|
|
${indent inputClassSection}
|
2009-09-10 12:37:33 +00:00
|
|
|
|
EndSection
|
2025-04-01 20:10:43 +02:00
|
|
|
|
'')}
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
Section "ServerLayout"
|
|
|
|
|
Identifier "Layout[all]"
|
|
|
|
|
${indent cfg.serverLayoutSection}
|
|
|
|
|
# Reference the Screen sections for each driver. This will
|
|
|
|
|
# cause the X server to try each in turn.
|
|
|
|
|
${flip concatMapStrings (filter (d: d.display) cfg.drivers) (d: ''
|
|
|
|
|
Screen "Screen-${d.name}[0]"
|
2015-04-12 23:49:48 +02:00
|
|
|
|
'')}
|
2025-04-01 20:10:43 +02:00
|
|
|
|
EndSection
|
|
|
|
|
|
|
|
|
|
# For each supported driver, add a "Device" and "Screen"
|
|
|
|
|
# section.
|
|
|
|
|
${flip concatMapStrings cfg.drivers (driver: ''
|
|
|
|
|
|
|
|
|
|
Section "Device"
|
|
|
|
|
Identifier "Device-${driver.name}[0]"
|
|
|
|
|
Driver "${driver.driverName or driver.name}"
|
|
|
|
|
${indent (optionalString cfg.enableTearFree ''Option "TearFree" "true"'')}
|
|
|
|
|
${indent cfg.deviceSection}
|
|
|
|
|
${indent (driver.deviceSection or "")}
|
|
|
|
|
${indent xrandrDeviceSection}
|
2009-09-10 12:37:33 +00:00
|
|
|
|
EndSection
|
2025-04-01 20:10:43 +02:00
|
|
|
|
${optionalString driver.display ''
|
|
|
|
|
|
|
|
|
|
Section "Screen"
|
|
|
|
|
Identifier "Screen-${driver.name}[0]"
|
|
|
|
|
Device "Device-${driver.name}[0]"
|
|
|
|
|
${optionalString (cfg.monitorSection != "") ''
|
|
|
|
|
Monitor "Monitor[0]"
|
|
|
|
|
''}
|
|
|
|
|
|
|
|
|
|
${indent cfg.screenSection}
|
|
|
|
|
${indent (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}"
|
|
|
|
|
}
|
|
|
|
|
${indent cfg.extraDisplaySettings}
|
|
|
|
|
${optionalString (
|
|
|
|
|
cfg.virtualScreen != null
|
|
|
|
|
) "Virtual ${toString cfg.virtualScreen.x} ${toString cfg.virtualScreen.y}"}
|
|
|
|
|
EndSubSection
|
|
|
|
|
'';
|
|
|
|
|
in
|
|
|
|
|
concatMapStrings f [
|
|
|
|
|
8
|
|
|
|
|
16
|
|
|
|
|
24
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
}
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2009-11-06 00:59:03 +00:00
|
|
|
|
EndSection
|
2025-04-01 20:10:43 +02:00
|
|
|
|
''}
|
|
|
|
|
'')}
|
2019-08-14 12:37:03 -04:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
${xrandrMonitorSections}
|
2009-11-06 00:59:03 +00:00
|
|
|
|
|
2025-04-01 20:10:43 +02:00
|
|
|
|
${cfg.extraConfig}
|
|
|
|
|
'';
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2023-07-19 13:43:36 +02:00
|
|
|
|
fonts.packages = [
|
2023-03-20 21:22:22 +03:00
|
|
|
|
(if cfg.upscaleDefaultCursor then fontcursormisc_hidpi else pkgs.xorg.fontcursormisc)
|
|
|
|
|
pkgs.xorg.fontmiscmisc
|
|
|
|
|
];
|
2016-09-05 15:48:48 +02:00
|
|
|
|
|
2013-10-30 18:30:23 +01:00
|
|
|
|
};
|
2009-09-10 12:37:33 +00:00
|
|
|
|
|
2021-11-19 00:26:27 +01:00
|
|
|
|
# uses relatedPackages
|
|
|
|
|
meta.buildDocsInSandbox = false;
|
2006-11-28 22:27:56 +00:00
|
|
|
|
}
|