As noted here this option accepts strings concatenated by “\n”.
Here is a snippet of the relevant parts from my configuration:
let
qwertz = [
"keycode 29 = z"
"keycode 52 = y"
];
applyXmod = keycode: "${pkgs.xorg.xmodmap}/bin/xmodmap -e " + keycode;
in
...
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?