nixos/xserver: make logFile configurable

It makes sense for it to be /dev/null for all the displayManagers but startx,
it needs a different logFile configuration.
This commit is contained in:
Atemu 2020-02-15 22:53:56 +01:00
parent a5ea1b6fb3
commit 693a31ab7b

View File

@ -518,6 +518,19 @@ in
'';
};
logFile = mkOption {
type = types.nullOr types.str;
default = "/dev/null";
example = "/var/log/Xorg.0.log";
description = ''
Controls the file Xorg logs to.
The default of <literal>/dev/null</literal> is set so that systemd services (like <literal>displayManagers</literal>) only log to the journal and don't create their own log files.
Setting this to <literal>null</literal> will not pass the <literal>-logfile</literal> argument to Xorg which allows it to log to its default logfile locations instead (see <literal>man Xorg</literal>). You probably only want this behaviour when running Xorg manually (e.g. via <literal>startx</literal>).
'';
};
verbose = mkOption {
type = types.nullOr types.int;
default = 3;
@ -692,11 +705,10 @@ in
services.xserver.displayManager.xserverArgs =
[ "-config ${configFile}"
"-xkbdir" "${cfg.xkbDir}"
# Log at the default verbosity level to stderr rather than /var/log/X.*.log.
"-logfile" "/dev/null"
] ++ 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}"