nixpkgs/nixos
8573 34435a9502 redshift: Fix default value of $DISPLAY (#17746)
Before commit 54fa0cfe4e, the `redshift`
service was run with the environment variable `DISPLAY` set to `:0`.

Commit 54fa0cfe4e changed this to
instead use the value of the `services.xserver.display` configuration
option in the value of the `DISPLAY` variable. In so doing, no default
value was provided for the case where `services.xserver.display` is
`null`.

While the default value of `services.xserver.display` is `0`, use of
which by the `redshift` module would result in `DISPLAY` again being
set to `:0`, `services.xserver.display` may also be `null`, to which
value it is set by, e.g., the `lightdm` module.

In the case that `services.xserver.display` is `null`, with the change
made in commit 54fa0cfe4e, the `DISPLAY`
variable in the environment of the `redshift` service would be set to
`:` (a single colon), which, according to my personal experience,
would result in —

  - the `redshift` service failing to start; and

  - systemd repeatedly attempting to restart the `redshift` service,
    looping indefinitely, while the hapless `redshift` spews error
    messages into the journal.

It can be observed that the malformed value of `DISPLAY` is likely at
fault for this issue by executing the following commands in an
ordinary shell, with a suitable `redshift` executable, and the X11
display not already tinted:

  - `redshift -O 2500` — This command should reduce the color
    temperature of the display (making it more reddish).

  - `DISPLAY=':' redshift -O 6500` — This command should raise the
    color temperature back up, were it not for the `DISPLAY`
    environment variable being set to `:` for it, which should cause
    it to, instead, fail with several error messages.

This commit attempts to fix this issue by having the `DISPLAY`
environment variable for the `redshift` service default to its old
value of `:0` in the case that `services.xserver.display` is `null`.

I have tested this solution on NixOS, albeit without the benefit of a
system with multiple displays.
2016-08-17 13:34:26 +02:00
..
doc/manual grsecurity docs: mention chromium setuid sandbox 2016-08-15 20:36:47 +02:00
lib nixos/lib/make-disk-image: refactor to use nixos-install 2016-08-16 15:31:16 +01:00
maintainers Add AMIs in ap-northeast-2 and ap-south-1 2016-07-12 17:26:25 +02:00
modules redshift: Fix default value of $DISPLAY (#17746) 2016-08-17 13:34:26 +02:00
tests nixos/tests/ecryptfs: placate some commands causing many builds failure 2016-08-16 02:47:08 +01:00
COPYING Move all of NixOS to nixos/ in preparation of the repository merge 2013-10-10 13:28:20 +02:00
default.nix nix: Add a "dev" output 2016-04-18 21:13:18 +02:00
README Move all of NixOS to nixos/ in preparation of the repository merge 2013-10-10 13:28:20 +02:00
release-combined.nix Remove nixos.tests.boot.biosUsb.* as release blockers 2016-07-21 11:44:55 +02:00
release-small.nix release-small: drop mysql51, removed in 975d33e6 2016-08-13 09:46:42 +02:00
release.nix netboot: prepare for https://github.com/NixOS/nixos-channel-scripts/issues/6 2016-08-16 17:27:11 +02:00

*** NixOS ***

NixOS is a Linux distribution based on the purely functional package
management system Nix.  More information can be found at
http://nixos.org/nixos and in the manual in doc/manual.