From 693a31ab7b53de423d4ed87f35a6a43604d02039 Mon Sep 17 00:00:00 2001 From: Atemu Date: Sat, 15 Feb 2020 22:53:56 +0100 Subject: [PATCH] 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. --- nixos/modules/services/x11/xserver.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 9e971671c47..eb8c4c17e98 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -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 /dev/null is set so that systemd services (like displayManagers) only log to the journal and don't create their own log files. + + 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). + ''; + }; + 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}"