From e4d8cb8dabb0b7ec7b5f785a5cebd34909df0603 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Wed, 27 Jul 2016 21:37:39 +0800 Subject: [PATCH] iio-sensor-proxy: init at 2.2 and nixos module This PR adds support for ```iio-sensor-proxy``` used by GNOME v3 and others for reading data from the accelerometer, gps, compass and similar sensors built into some relatively recent laptops. Additionally, there is a NixOS module exposed via hardware.sensor.iio for enabling services, udev rules and dbus services. --- nixos/modules/hardware/sensor/iio.nix | 30 ++++++++++++ nixos/modules/module-list.nix | 1 + .../linux/iio-sensor-proxy/default.nix | 47 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 80 insertions(+) create mode 100644 nixos/modules/hardware/sensor/iio.nix create mode 100644 pkgs/os-specific/linux/iio-sensor-proxy/default.nix diff --git a/nixos/modules/hardware/sensor/iio.nix b/nixos/modules/hardware/sensor/iio.nix new file mode 100644 index 000000000000..a8bc18800021 --- /dev/null +++ b/nixos/modules/hardware/sensor/iio.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + ###### interface + + options = { + hardware.sensor.iio = { + enable = mkOption { + description = "Enable this option to support IIO sensors."; + type = types.bool; + default = false; + }; + }; + }; + + ###### implementation + + config = mkIf config.hardware.sensor.iio.enable { + + boot.initrd.availableKernelModules = [ "hid-sensor-hub" ]; + + environment.systemPackages = with pkgs; [ iio-sensor-proxy ]; + + services.dbus.packages = with pkgs; [ iio-sensor-proxy ]; + services.udev.packages = with pkgs; [ iio-sensor-proxy ]; + systemd.packages = with pkgs; [ iio-sensor-proxy ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 8ec985acae3b..ee43e538f6d5 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -29,6 +29,7 @@ ./hardware/ckb.nix ./hardware/cpu/amd-microcode.nix ./hardware/cpu/intel-microcode.nix + ./hardware/sensor/iio.nix ./hardware/ksm.nix ./hardware/network/b43.nix ./hardware/network/intel-2100bg.nix diff --git a/pkgs/os-specific/linux/iio-sensor-proxy/default.nix b/pkgs/os-specific/linux/iio-sensor-proxy/default.nix new file mode 100644 index 000000000000..cdcae22a18e9 --- /dev/null +++ b/pkgs/os-specific/linux/iio-sensor-proxy/default.nix @@ -0,0 +1,47 @@ +{ stdenv, fetchFromGitHub, autoconf-archive, gettext, libtool, intltool, autoconf, automake +, glib, gtk3, gtk_doc, libgudev, pkgconfig, systemd }: + +stdenv.mkDerivation rec { + name = "iio-sensor-proxy-${version}"; + version = "2.2"; + + src = fetchFromGitHub { + owner = "hadess"; + repo = "iio-sensor-proxy"; + rev = version; + sha256 = "1x0whwm2r9g50hq5px0bgsrigy8naihqgi6qm0x5q87jz5lkhrnv"; + }; + + configurePhase = '' + ./autogen.sh --prefix=$out \ + --with-udevrulesdir=$out/lib/udev/rules.d \ + --with-systemdsystemunitdir=$out/lib/systemd/system + ''; + + buildInputs = [ + glib + gtk3 + gtk_doc + libgudev + systemd + ]; + + nativeBuildInputs = [ + autoconf + autoconf-archive + automake + gettext + intltool + libtool + pkgconfig + ]; + + meta = with stdenv.lib; { + description = "Proxy for sending IIO sensor data to D-Bus"; + homepage = https://github.com/hadess/iio-sensor-proxy; + license = licenses.gpl3 ; + maintainers = with maintainers; [ peterhoeg ]; + platforms = platforms.linux; + inherit version; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1224593a2abb..30cf7582ba61 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -932,6 +932,8 @@ with pkgs; long-shebang = callPackage ../misc/long-shebang {}; + iio-sensor-proxy = callPackage ../os-specific/linux/iio-sensor-proxy { }; + mathics = pythonPackages.mathics; meson = callPackage ../development/tools/build-managers/meson { };