Add an option to write the X session log to the journal
... rather than ~/.xsession-errors. It might make sense to make this the default, in order to eliminate ad hoc, uncentralised, poorly discoverable log files.
This commit is contained in:
parent
d84741a4bf
commit
c99608c638
2 changed files with 21 additions and 1 deletions
|
@ -32,6 +32,12 @@ let
|
|||
''
|
||||
#! ${pkgs.bash}/bin/bash
|
||||
|
||||
${optionalString cfg.displayManager.logToJournal ''
|
||||
if [ -z "$_DID_SYSTEMD_CAT" ]; then
|
||||
_DID_SYSTEMD_CAT=1 exec ${config.systemd.package}/bin/systemd-cat -t xsession -- "$0" "$sessionType"
|
||||
fi
|
||||
''}
|
||||
|
||||
. /etc/profile
|
||||
cd "$HOME"
|
||||
|
||||
|
@ -39,7 +45,7 @@ let
|
|||
sessionType="$1"
|
||||
if [ "$sessionType" = default ]; then sessionType=""; fi
|
||||
|
||||
${optionalString (!cfg.displayManager.job.logsXsession) ''
|
||||
${optionalString (!cfg.displayManager.job.logsXsession && !cfg.displayManager.logToJournal) ''
|
||||
exec > ~/.xsession-errors 2>&1
|
||||
''}
|
||||
|
||||
|
@ -83,6 +89,8 @@ let
|
|||
# .local/share doesn't exist yet.
|
||||
mkdir -p $HOME/.local/share
|
||||
|
||||
unset _DID_SYSTEMD_CAT
|
||||
|
||||
${cfg.displayManager.sessionCommands}
|
||||
|
||||
# Allow the user to execute commands at the beginning of the X session.
|
||||
|
@ -278,6 +286,16 @@ in
|
|||
|
||||
};
|
||||
|
||||
logToJournal = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
By default, the stdout/stderr of sessions is written
|
||||
to <filename>~/.xsession-errors</filename>. When this option
|
||||
is enabled, it will instead be written to the journal.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -113,6 +113,8 @@ let kernel = config.boot.kernelPackages.kernel; in
|
|||
# Make it easy to log in as root when running the test interactively.
|
||||
users.extraUsers.root.initialHashedPassword = mkOverride 150 "";
|
||||
|
||||
services.xserver.displayManager.logToJournal = true;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue