Enabling iio-sensor-proxy

I am trying to install iio-sensor-proxy to to use screen autorotation in Gnome3. Following the wiki, I have added:

  hardware.sensor.iio.enable = true;

to configuration.nix. This seems to be insufficient to get the command iio-sensor-proxy, so I also added iio-sensor-proxy to environment.systemPackages. I have also tried to install it using nix-env -iA nixos.iio-sensor-proxy. I would expect the service to be enabled after restarting, but monitor-sensor just outputs

Waiting for iio-sensor-proxy to appear.

When I call iio-sensor-proxy after having installed it with nix-env, it just exits without any output.

Am I missing something?

Using NixOs 20.03.2425.9a3e34ae601 (Markhor).

I have the suspicion that this has to do with the old GitHub repo for iio-sensor-proxy not being there anymore. My knowledge of Nix is quite limited but I will try to make the derivation point to the new repository.

I use KDE and not Gnome, but there all it takes is setting the option you mention:

hardware.sensor.iio.enable = true;

Adding it to systemPackages doesn’t do anything else but give you the detect bin (and the other binaries) in your path.

Thank you, having confirmation that it should work was indeed useful. The problem was somewhere else completely: new generations were not appearing on the GRUB menu and the same old generation was loading again and again each time I restarted to test iio-sensor-proxy. So, it was quite a stupid error having nothing to do with iio-sensor-proxy nor gnome (should I change the title to make this more useful to others?).

Can you confirm that this makes the rotation lock option show up in GNOME’s system menu and/or the GNOME settings?

Sensors seem to work

When I run monitor-sensor the output suggests that the orientation change is detected:

$ monitor-sensor
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: normal, tilt: tilted-down)
=== No ambient light sensor
=== No proximity sensor
=== No compass
    Tilt changed: vertical
    Tilt changed: tilted-down
    Accelerometer orientation changed: left-down
    Tilt changed: vertical
    Accelerometer orientation changed: normal

But neither does the screen orientation change nor does GOME’s system menu in the top right corner suggest it has taken notice of the feature. :worried:

Rotation lock missing from GNOME settings

Also, the GNOME settings don’t show any trace of the orientation lock or similar. And shouldn’t gsettings have a org.gnome.settings-daemon.plugins.orientation schema for the orientation feature? This is missing here, currently. :face_holding_back_tears:

$ gsettings list-children org.gnome.settings-daemon.plugins
color          org.gnome.settings-daemon.plugins.color
housekeeping   org.gnome.settings-daemon.plugins.housekeeping
media-keys     org.gnome.settings-daemon.plugins.media-keys
power          org.gnome.settings-daemon.plugins.power
xsettings      org.gnome.settings-daemon.plugins.xsettings

Any ideas?

Oh, wow! – GNOME is so smart! :joy: :heart:

The rotation lock feature is hidden when your laptop is in “laptop mode” (note: I have a ThinkPad X1 Yoga convertible).

As soon as you fold your device, the orientation change feature is only activated!! … and the rotation lock option appears in the system menu. :heart: :heart_eyes:

So, it’s all good. NixOS and GNOME rock!!