Compressed sessionCommands

As noted here this option accepts strings concatenated by “\n”.

Here is a snippet of the relevant parts from my configuration:

  qwertz = [
    "keycode 29 = z"
    "keycode 52 = y"
  applyXmod = keycode: "${pkgs.xorg.xmodmap}/bin/xmodmap -e " + keycode;
services.xserver.displayManager.sessionCommands = builtins.concatStringsSep "\n" (map applyXmod qwertz);

When I apply nixos-rebuild switch --show-trace and reboot, the command obviously was not applied.

How can I make this concatenation work in this scenario?

The changes are probably applied but xmodmap errors as it doesn’t understand the expression.

You need to wrap the expression in double quotes that end up in the generated shell script.

Yes, thought that too, I did something like this:

''"keycode 29 = z"''

This did not work either, though…

Have you looked at the generated session script and ran the commands individually?

Where can I see that?