Subject: [PATCH v1 4/5] services: Add corectrl-helper-service-type.

From: Ashvith Shetty <[email-masked]>
Date: Sat, 28 Dec 2024 21:00:06 +0530

* gnu/services/pciutils.scm: New file.
(corectrl-helper-service-type): new variable.
* gnu/local.mk: Add them.
* doc/guix.texi (Miscellaneous Services): Document it.

Change-Id: I1dbeb927100a9a488909ff1950ec7e50d3797c29
---
 doc/guix.texi             | 15 ++++++++++++++
 gnu/local.mk              |  1 +
 gnu/services/pciutils.scm | 43 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+)
 create mode 100644 gnu/services/pciutils.scm

diff --git a/doc/guix.texi b/doc/guix.texi
index da4d2f5ebc..a36d3cc0f1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -42550,6 +42550,21 @@ empty list means that no type is specified.
 
 @end deftp
 
+@cindex corectrl-helper
+@subsubheading CoreCtrl Helper Service
+
+The @code{(gnu services pciutils)} module provides a DBus service for 
+interacting with system hardware resources, such as CPU and GPU, 
+enabling advanced control and management through the CoreCtrl application.
+
+@defvar corectrl-helper-service-type
+The service type for @command{corectrl}, which provides a helper service.
+
+@lisp
+(service corectrl-helper-service-type)
+@end lisp
+@end defvar
+
 @c %end of fragment
 
 @node Privileged Programs
diff --git a/gnu/local.mk b/gnu/local.mk
index 84160f407a..5ebdb72624 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -751,6 +751,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/services/nix.scm				\
   %D%/services/nfs.scm			\
   %D%/services/pam-mount.scm			\
+  %D%/services/pciutils.scm			\
   %D%/services/science.scm			\
   %D%/services/security.scm			\
   %D%/services/security-token.scm		\
diff --git a/gnu/services/pciutils.scm b/gnu/services/pciutils.scm
new file mode 100644
index 0000000000..cfd310b584
--- /dev/null
+++ b/gnu/services/pciutils.scm
@@ -0,0 +1,43 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2024 Ashvith Shetty <[email-masked]>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services pciutils)
+  #:use-module (gnu packages pciutils)
+  #:use-module (gnu services)
+  #:use-module (gnu services configuration)
+  #:use-module (gnu services dbus)
+  #:use-module (guix gexp)
+  #:export (corectrl-helper-configuration
+            corectrl-helper-configuration?
+            corectrl-helper-service-type))
+
+(define-configuration corectrl-helper-configuration
+  (corectrl (file-like corectrl) "The corectrl package"))
+
+(define (corectrl-helper-dbus-service config)
+  (list (corectrl-helper-configuration-corectrl config)))
+
+(define corectrl-helper-service-type
+  (service-type (name 'corectrl-helper)
+                (extensions (list (service-extension dbus-root-service-type
+                                                     corectrl-helper-dbus-service)
+                                  (service-extension polkit-service-type
+                                                     corectrl-helper-dbus-service)))
+                (default-value (corectrl-helper-configuration))
+                ;; TODO: Improve the description.
+                (description "Run corectrl-helper, an essential service for the corectrl application.")))
-- 
2.46.0