git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/xserver: fix X.org session script logging
commit13bb5ff4027bb148754fd1cfdf2a5653d7f77101 authorrnhmjoj <rnhmjoj@inventati.org> dateFri 15 Sep 2017, 00:08 (9 years ago) parentdc5cd78
5 files changed+29−26
nixos/modules/rename.nix+4 nixos/modules/services/x11/display-managers/default.nix+22−23 nixos/modules/services/x11/display-managers/lightdm.nix+1−1 nixos/modules/services/x11/display-managers/sddm.nix+1−1 nixos/modules/services/x11/display-managers/xpra.nix+1−1
nixos/modules/rename.nix+4
@@ -48,6 +48,10 @@ with lib;
4848 (mkRemovedOptionModule [ "services" "rmilter" "bindInetSockets" ] "Use services.rmilter.bindSocket.* instead")
4949 (mkRemovedOptionModule [ "services" "rmilter" "bindUnixSockets" ] "Use services.rmilter.bindSocket.* instead")
5050
51+ # Xsession script
52+ (mkRenamedOptionModule [ "services" "xserver" "displayManager" "job" "logsXsession" ] [ "services" "xserver" "displayManager" "job" "logToFile" ])
53+ (mkRenamedOptionModule [ "services" "xserver" "displayManager" "logToJournal" ] [ "services" "xserver" "displayManager" "job" "logToJournal" ])
54+
5155 # Old Grub-related options.
5256 (mkRenamedOptionModule [ "boot" "initrd" "extraKernelModules" ] [ "boot" "initrd" "kernelModules" ])
5357 (mkRenamedOptionModule [ "boot" "extraKernelParams" ] [ "boot" "kernelParams" ])
nixos/modules/services/x11/display-managers/default.nix+22−23
@@ -59,12 +59,6 @@ let
5959 # Now it should be safe to assume that the script was called with the
6060 # expected parameters.
6161
62− ${optionalString cfg.displayManager.logToJournal ''
63− if [ -z "$_DID_SYSTEMD_CAT" ]; then
64− _DID_SYSTEMD_CAT=1 exec ${config.systemd.package}/bin/systemd-cat -t xsession -- "$0" "$@"
65− fi
66− ''}
67−
6862 . /etc/profile
6963 cd "$HOME"
7064
@@ -72,16 +66,23 @@ let
7266 sessionType="$1"
7367 if [ "$sessionType" = default ]; then sessionType=""; fi
7468
75− ${optionalString (!cfg.displayManager.job.logsXsession && !cfg.displayManager.logToJournal) ''
76− exec > ~/.xsession-errors 2>&1
77− ''}
78−
7969 ${optionalString cfg.startDbusSession ''
8070 if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
8171 exec ${pkgs.dbus.dbus-launch} --exit-with-session "$0" "$sessionType"
8272 fi
8373 ''}
8474
75+ ${optionalString cfg.displayManager.job.logToJournal ''
76+ if [ -z "$_DID_SYSTEMD_CAT" ]; then
77+ export _DID_SYSTEMD_CAT=1
78+ exec ${config.systemd.package}/bin/systemd-cat -t xsession "$0" "$sessionType"
79+ fi
80+ ''}
81+
82+ ${optionalString cfg.displayManager.job.logToFile ''
83+ exec &> >(tee ~/.xsession-errors)
84+ ''}
85+
8586 # Start PulseAudio if enabled.
8687 ${optionalString (config.hardware.pulseaudio.enable) ''
8788 ${optionalString (!config.hardware.pulseaudio.systemWide)
@@ -306,26 +307,24 @@ in
306307 description = "Additional environment variables needed by the display manager.";
307308 };
308309
309− logsXsession = mkOption {
310+ logToFile = mkOption {
310311 type = types.bool;
311312 default = false;
312313 description = ''
313− Whether the display manager redirects the
314− output of the session script to
315− <filename>~/.xsession-errors</filename>.
314+ Whether the display manager redirects the output of the
315+ session script to <filename>~/.xsession-errors</filename>.
316316 '';
317317 };
318318
319− };
319+ logToJournal = mkOption {
320+ type = types.bool;
321+ default = true;
322+ description = ''
323+ Whether the display manager redirects the output of the
324+ session script to the systemd journal.
325+ '';
326+ };
320327
321− logToJournal = mkOption {
322− type = types.bool;
323− default = true;
324− description = ''
325− By default, the stdout/stderr of sessions is written
326− to <filename>~/.xsession-errors</filename>. When this option
327− is enabled, it will instead be written to the journal.
328− '';
329328 };
330329
331330 };
nixos/modules/services/x11/display-managers/lightdm.nix+1−1
@@ -190,7 +190,7 @@ in
190190 services.xserver.displayManager.slim.enable = false;
191191
192192 services.xserver.displayManager.job = {
193− logsXsession = true;
193+ logToFile = true;
194194
195195 # lightdm relaunches itself via just `lightdm`, so needs to be on the PATH
196196 execCmd = ''
nixos/modules/services/x11/display-managers/sddm.nix+1−1
@@ -205,7 +205,7 @@ in
205205 services.xserver.displayManager.slim.enable = false;
206206
207207 services.xserver.displayManager.job = {
208− logsXsession = true;
208+ logToFile = true;
209209
210210 environment = {
211211 # Load themes from system environment
nixos/modules/services/x11/display-managers/xpra.nix+1−1
@@ -220,7 +220,7 @@ in
220220 '';
221221
222222 services.xserver.displayManager.job = {
223− logsXsession = true;
223+ logToFile = true;
224224
225225 execCmd = ''
226226 ${optionalString (cfg.pulseaudio)