From 78f05b29c1d8a2558098d3783efd709319bdccc1 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 16 Oct 2025 23:59:14 +0800 Subject: [PATCH] gnu: Add iio-sensor-proxy-service-type. * gnu/services/desktop.scm (iio-sensor-proxy-configuration) (iio-sensor-proxy-shepherd-service, iio-sensor-proxy-service-type): New variables. * doc/guix.texi (Desktop Services): Document iio-sensor-proxy-service-type. Change-Id: I0c3d7164efcc499e4b785fd1f994c68a971ebdbd Signed-off-by: Liliana Marie Prikler --- doc/guix.texi | 32 +++++++++++++++++++++++++ gnu/services/desktop.scm | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 55eaabf0db..8ce1492a3b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -145,6 +145,7 @@ Copyright @copyright{} 2025 jgart@* Copyright @copyright{} 2025 Artur Wroblewski@* Copyright @copyright{} 2025 Edouard Klein@* Copyright @copyright{} 2025 Rodion Goritskov@* +Copyright @copyright{} 2025 dan@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -27046,6 +27047,37 @@ The value for this service is a @code{} object. @c TODO: Document , preferably by refactoring this to use @c define-configuration and generating documentation from it. +@defvar iio-sensor-proxy-service-type +Type for the service that runs +@uref{https://gitlab.freedesktop.org/hadess/iio-sensor-proxy, IIO sensor +proxy}, a daemon that proxies low-level sensor data from Industrial I/O +(IIO) devices into a D-Bus interface. It enables user-space +applications, such as desktop environments like GNOME and KDE, and +services like GeoClue, to access data from various sensors commonly +found in devices like ultrabooks and 2-in-1s. This allows for: + +@itemize @bullet +@item +Automatic screen rotation based on accelerometer data. +@item +Ambient brightness adjustment using light sensor data. +@item +Compass/direction information for location services (via GeoClue). +@end itemize + +The value for this service is a @code{} object. +@end defvar + +@deftp {Data Type} iio-sensor-proxy-configuration +Data type representing the configuration for @code{iio-sensor-proxy-service-type}. + +@table @asis +@item @code{iio-sensor-proxy} (default: @code{iio-sensor-proxy}) (type: file-like) +Package object of iio-sensor-proxy. + +@end table +@end deftp + @defvar bluetooth-service-type This is the type for the @uref{https://bluez.org/, Linux Bluetooth Protocol Stack} (BlueZ) system, which generates the @file{/etc/bluetooth/main.conf} diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 4e5bc9a456..eff502b7fb 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -21,6 +21,7 @@ ;;; Copyright © 2024 Raven Hallsby ;;; Copyright © 2025 Jonathan Brielmaier ;;; Copyright © 2025 Sergio Pastor Pérez +;;; Copyright © 2025 dan ;;; ;;; This file is part of GNU Guix. ;;; @@ -127,6 +128,11 @@ geoclue-service ; deprecated geoclue-service-type + iio-sensor-proxy-configuration + iio-sensor-proxy-configuration? + iio-sensor-proxy-configuration-io-sensor-proxy + iio-sensor-proxy-service-type + bluetooth-service-type bluetooth-configuration bluetooth-configuration? @@ -479,6 +485,50 @@ site} for more information." (submission-nick submission-nick) (applications applications)))) + +;;; +;;; IIO Sensor proxy. +;;; + +(define-record-type* + iio-sensor-proxy-configuration make-iio-sensor-proxy-configuration + iio-sensor-proxy-configuration? + (iio-sensor-proxy iio-sensor-proxy-configuration-iio-sensor-proxy + (default iio-sensor-proxy))) + +(define iio-sensor-proxy-shepherd-service + (match-record-lambda + (iio-sensor-proxy) + (list (shepherd-service + (documentation "IIO sensors to D-Bus proxy") + (requirement '(user-processes dbus-system udev)) + (provision '(iio-sensor-proxy)) + (start #~(make-forkexec-constructor + (list #$(file-append iio-sensor-proxy + "/libexec/iio-sensor-proxy")))) + (stop #~(make-kill-destructor)))))) + +(define iio-sensor-proxy-service-type + (let ((iio-sensor-proxy-package + (match-record-lambda + (iio-sensor-proxy) + (list iio-sensor-proxy)))) + (service-type + (name 'iio-sensor-proxy) + (extensions + (list (service-extension polkit-service-type + iio-sensor-proxy-package) + (service-extension dbus-root-service-type + iio-sensor-proxy-package) + (service-extension udev-service-type + iio-sensor-proxy-package) + (service-extension shepherd-root-service-type + iio-sensor-proxy-shepherd-service))) + (default-value (iio-sensor-proxy-configuration)) + (description + "Run the @command{iio-sensor-proxy} daemon, which provides IIO sensors data +through a D-Bus interface.")))) + ;;; ;;; Bluetooth.