Tips for using NixOS with a vertical monitor?

Hello, do you have any tips on how to use NixOS with a vertical monitor.

My setup has startx as my “display manager” along with i3 and use a single monitor 1600x900.

Look at the services.xserver.xrandrHeads configuration option. It supports declaring monitors with rotation. You could also keep your script setting up the monitor.
For i3, use services.xserver.windowManager.i3.enable as stated in the manual.


I use sway (i3, but for Wayland). sway config allows to specify a rotation argument to outputs, like this:

output DP-1 {
    mode 1920x1080
    transform 90 # for rotatin 90 degrees clockwise
    # etc...

For more details, see man 5 sway-output.

By the way, if you frequently change monitor setups (e.g a monitor at work and just the laptop screen otherwise), there is a companion daemon called kanshi. It allows to have a separate configuration for each set of outputs, e.g. for the above case:

work {
	output "Dell Inc. DELL P2419HC 6LZCJQ2" mode 1920x1080 position 0,0
	output eDP-1 position 1920,0

mobile {
	output eDP-1

This sets my display at work to be to the left of my laptop screen.

1 Like