1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7{
8 ###### interface
9
10 options = {
11 hardware.sensor.iio = {
12 enable = lib.mkOption {
13 description = ''
14 Enable this option to support IIO sensors with iio-sensor-proxy.
15
16 IIO sensors are used for orientation and ambient light
17 sensors on some mobile devices.
18 '';
19 type = lib.types.bool;
20 default = false;
21 };
22 };
23 };
24
25 ###### implementation
26
27 config = lib.mkIf config.hardware.sensor.iio.enable {
28
29 boot.initrd.availableKernelModules = [ "hid-sensor-hub" ];
30
31 environment.systemPackages = with pkgs; [ iio-sensor-proxy ];
32
33 services.dbus.packages = with pkgs; [ iio-sensor-proxy ];
34 services.udev.packages = with pkgs; [ iio-sensor-proxy ];
35 systemd.packages = with pkgs; [ iio-sensor-proxy ];
36 };
37}