If enabled srun will accept the option "--x11" to allow for X11 forwarding from within an interactive session or a batch job. This activates the slurm-spank-x11 module. Note that this option also enables services.openssh.forwardX11 on the client.
This option requires slurm to be compiled without native X11 support. The default behavior is to re-compile the slurm package with native X11 support disabled if this option is set to true.
To use the native X11 support add PrologFlags=X11
in extraConfig. Note that this method will only work RSA SSH host keys.