3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services
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
..
admin
amqp
audio Merge pull request #151642 from antifuchs/fix-151550 2022-06-26 23:32:18 +02:00
backup nixos/restic: add backup{Prepare,Cleanup}Command options 2022-06-03 11:22:22 -03:00
blockchain/ethereum
cluster k3s: remove docker support 2022-06-15 16:40:29 -03:00
computing nixos/slurm: update systemd service for slurmd 2022-05-29 17:17:01 +02:00
continuous-integration hydra: create runcommand-logs directory 2022-06-06 11:36:58 -07:00
databases dgraph: add module 2022-06-28 02:34:54 -04:00
desktops nixos/pipewire: fix wireplumber with system-wide 2022-06-18 18:46:41 -07:00
development
display-managers
editors
finance
games nixos/asf: ipcPasswordFile use nullOr 2022-06-04 12:00:45 -06:00
hardware nixos/argonone: init 2022-06-24 21:20:32 -03:00
home-automation nixos/home-assistant: reload the daemon when configuration changed 2022-06-22 16:20:11 +02:00
logging logrotate: do not add mail if 'mail = false' is specified 2022-06-13 08:57:49 +09:00
mail nixos/schleuder: init module and accompanying test 2022-06-24 15:30:16 -04:00
matrix nixos/matrix-appservice-irc: wait for postgres to start 2022-06-24 08:37:43 +02:00
misc Merge pull request #177783 from talyz/parsedmarc-secrets 2022-06-27 15:26:10 +02:00
monitoring Merge pull request #177783 from talyz/parsedmarc-secrets 2022-06-27 15:26:10 +02:00
network-filesystems Merge pull request #166340 from max-privatevoid/patch-6 2022-06-28 19:55:10 +03:00
networking Merge pull request #178783 from greizgh/fix-syncthing-doc 2022-06-27 22:37:56 +02:00
printing
scheduling
search
security nixos/vaultwarden: Make example more detailed. 2022-06-08 17:03:53 +02:00
system cachix-agent: expose verbose option 2022-06-30 09:56:28 -05:00
torrent
ttys
video
wayland treewide: pkgs.systemd -> config.systemd.package 2022-05-05 20:00:31 +02:00
web-apps Merge pull request #179425 from McSinyx/phylactery 2022-06-30 18:29:19 +03:00
web-servers nixos/nginx: allow recommended proxy settings to be enabled per location 2022-06-12 19:52:35 -04:00
x11 nixos/desktop-manager: Use literal newline to fix shell syntax 2022-07-01 16:30:47 +04:00