I am experimenting with using the NixOS test infra to write test me own system configs, and I thought I could use
screenshot like in the NixOS test for sway. But when I read into the implementation it seems like it just runs
screendump, which (according to the man page and my testing) it only dumps whats on a tty.
So I am left with a few simple questions.
- Is the use of
screenshot in the sway tests, just getting whats in the terminal and incapable of getting a whole screenshot of a wayland session?
- Is there somewhere I can see the output of the nixos tests (specifically the sway one)? I am assuming is run on hydra.
- Is there a way for me to obtain a screenshot of my sway based greetd session? If there a method threw the os (like screendump but not a tty) or from the virtualization software? I guess specifically I want a screen shot of what would be showing on all the monitors directly plugged into the (virtual) machine being tested.
I would deeply appreciate if anyone can clear any of this up for me.
Have you just tried it? That function is definitely intended for GUI captures. I assume
screendump grabs data from the actual framebuffer, which just happens to be in graphical mode when wayland is running, but can of course still be turned into an image.
It doesn’t do anything useful on my system, but I suspect this is because of hardware acceleration - the buffers are likely not available as usual. It probably still work just fine in a VM?
This would work for greetd as well, of course, both are just wayland sessions rendering to a framebuffer in graphics mode.
I did a lot of learning and now I understand everything…
So as you said @TLATER, nothing wrong with
screenshot. It works in graphical environments and I assumed that, because I copied some config from the nixos test for sway and my screenshots were blank,
screenshot (which uses
screendump under the hood) only could get the output from text ttys or something, because the man page for
screendump says “dump the contents of a virtual console to stdout” and I assumed “virtual console” meant “not graphical session”.
In fact the issue I was facing when using the config from the nixos test for sway was that I was using this bit of config
virtualisation.qemu.options = [
but I was missing
environment.variables."WLR_RENDERER" = "pixman"
this config was necessary, as the non-interactive tests use a version of qemu (qemu_test) that does not have graphics drivers (more or less… I think).
This also explains why I could not use this config I found here
virtualisation.qemu.options = [
with the non-interactive test. And that’s because
virgl and the gtk display are not available to qemu_test. Also that config would work in the interactive tests because it would use the “normal” qemu package, which had
virgl and gtk support.
This leaves me with a few questions.
- Why is
qemu_test used for the non-interactive tests (or why does it disable graphical support on a few levels)
- Also why does
screenshot seem to when I use it in interactive mode with
virgl (error below)?
pnmtopng: Unable to open file '/home/rosario/Documents/NixOS-Config/deps/system-configs/foo.png.ppm' for reading. fopen() returns errno 2 (No such file or directory)