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 package = lib.mkPackageOption pkgs "iio-sensor-proxy" { }; 24 }; 25 }; 26 27 ###### implementation 28 29 config = lib.mkIf config.hardware.sensor.iio.enable { 30 31 boot.initrd.availableKernelModules = [ "hid-sensor-hub" ]; 32 33 environment.systemPackages = [ config.hardware.sensor.iio.package ]; 34 35 services.dbus.packages = [ config.hardware.sensor.iio.package ]; 36 services.udev.packages = [ config.hardware.sensor.iio.package ]; 37 systemd.packages = [ config.hardware.sensor.iio.package ]; 38 }; 39}