diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-05-24 21:29:22 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-05-24 21:46:38 +0200 |
commit | c99608c63808f0fe244fe9619ef6d97bf8a5af6f (patch) | |
tree | 8393853ff70d784c1ce96b0c6039fcaea8a9feba /nixos/modules | |
parent | d84741a4bfb6ed2531ec7154479c147d2c9a737c (diff) |
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.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/x11/display-managers/default.nix | 20 | ||||
-rw-r--r-- | nixos/modules/testing/test-instrumentation.nix | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 376f9f4b46b5..09735dac0eb0 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -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. + ''; + }; + }; }; diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix index f0f56b17f20f..40a40c8a5700 100644 --- a/nixos/modules/testing/test-instrumentation.nix +++ b/nixos/modules/testing/test-instrumentation.nix @@ -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; + }; } |