nixpkgs/nixos/modules
Klemens Nanni 987400b848 nixos/desktop-manager: Use literal newline to fix shell syntax
Running `nixos/tests/keepassxc.nix` shows:
```
machine # [   18.705390] xsession[985]: /nix/store/2g2jx5c6x3p152wbiijr0rmky7byqivc-xsession: line 13: nn: command not found
```

This garbled bash script runs without `set -o errexit` and thus skips
"\n\n" as invalid command:
```
$ cat -n /nix/store/2g2jx5c6x3p152wbiijr0rmky7byqivc-xsession
...
\n\n
            if [ -e $HOME/.background-image ]; then
              /nix/store/wq1d1ph8wj4alpx78akvpbd0a0m9qkd1-feh-3.8/bin/feh --bg-scale  $HOME/.background-image
            fi
...
```

KeePassXC uses it through
`nixos/modules/services/x11/display-managers/default.nix`:
```
...
        # Script responsible for starting the window manager and the desktop manager.
        xsession = dm: wm: pkgs.writeScript "xsession" ''
          #! ${pkgs.bash}/bin/bash

          # Legacy session script used to construct .desktop files from
          # `services.xserver.displayManager.session` entries. Called from
          # `sessionWrapper`.

          # Start the window manager.
          ${wm.start}

          # Start the desktop manager.
          ${dm.start}
...
        '';
...
```

The bogus line was introduced in PR #160752:
```
commit 0bc0dc8090
Author: Shaw Vrana <shaw@vranix.com>
Date:   Fri Feb 18 11:27:42 2022 -0800

    desktop manager script: start properly

    Adds a missing line feed when X is enabled to the start script name
    and the appended if check. Resolves #160735
```

I have not tried to reproduce the original issue and thus don't know
why "\n\n" apparently gets interpreted fine in one place but remains
literal the `xsession` case.

However, using a literal newline must be valid for all cases and
certainly fixes the warning seen in KeePassXC tests.

Furthermore, starting the nix string (`''`) with a newline as usual also
fixes its overall indentation.
2022-07-01 16:30:47 +04:00
..
config Merge pull request #179204 from jtojnar/no-gtk-xdg-use-portal 2022-06-29 14:24:43 +02:00
hardware maintainers: remove volth 2022-06-29 00:52:12 +02:00
i18n/input-method Merge pull request #174218 from NickCao/fcitx5-qt6 2022-06-11 16:20:20 +00:00
installer nixos-generate-config: detect parallels virtualization 2022-06-29 16:01:08 +02:00
misc nixos/ids: fix typo in comment 2022-06-28 11:58:47 +00:00
profiles nixos/i18n: don't build all supportedLocales by default 2022-06-11 23:29:29 +02:00
programs nixos/xfconf: init 2022-06-26 14:29:01 -03:00
security Revert "nixos/security/wrappers: use an assertion for the existence check" 2022-06-12 15:38:05 -05:00
services nixos/desktop-manager: Use literal newline to fix shell syntax 2022-07-01 16:30:47 +04:00
system nixos/systemd: use cfg.package in systemPackages to avoid confusion 2022-06-09 22:44:28 +02:00
tasks nixos/networkd: add IPv6PrivacyExtensions=kernel for default networks 2022-06-21 17:12:01 +02:00
testing nixos/version: Warn about using the default of system.stateVersion 2022-05-05 12:22:31 +02:00
virtualisation Merge pull request #176146 from pennae/module-docs-markdown 2022-06-21 13:16:02 +02:00
module-list.nix Merge pull request #179425 from McSinyx/phylactery 2022-06-30 18:29:19 +03:00
rename.nix riak, nixos/riak: remove 2022-06-25 15:51:18 -04:00