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