How to open a Xorg server while being on a wayland session

I’m looking for a way to start a Xorg server with a single program on another tty and to chvt on this tty from a Wayland session. My main reason is that I use an application that cannot be run under xwayland at all. How can this be achieved ?

What i’ve tried so far:

Tried startx (with or without the -e, vt8 at the end etc…) :

$ startx -e my-xorg-app -- :1 vt8
[...]
(EE) xf86OpenConsole: Cannot open virtual console 4 (Permission denied)
$ sudo startx -e my-xorg-app -- :1
[...]
Errors from xkbcomp are not fatal to the X server
/run/current-system/sw/bin/xterm: bad command line option "xterm"

usage:  /run/current-system/sw/bin/xterm [-/+132] [-C] [-Sccn] [-T string]
    [-/+ah] [-/+ai] [-/+aw] [-b number] [-baudrate rate] [-/+bc] [...]

Type /run/current-system/sw/bin/xterm -help for a full description.

Also made some tries with xinit :

$ xinit my-xorg-app -- :1
[...]
(EE) xf86OpenConsole: Cannot open virtual console 4 (Permission denied)
$ sudo xinit /run/current-system/sw/bin/my-xorg-app -- :1
[...]
(EE)
Fatal server error:
(EE) Cannot open log file "/nix/store/7m9nvr09gi0ihdbmy53vcdxavf6x2l9v-xorg-server-1.20.7/var/log/Xorg.1.log"
1 Like