[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#70460] [PATCH 4/4] gnu: services: Add power-profiles-daemon-service
From: |
Dariqq |
Subject: |
[bug#70460] [PATCH 4/4] gnu: services: Add power-profiles-daemon-service-type. |
Date: |
Thu, 18 Apr 2024 18:36:04 +0000 |
* gnu/services/pm.scm
(power-profiles-configuration): New configuration.
(power-profiles-daemon-shepherd-service): New function.
(power-profiles-daemon-service-type): New function.
(power-profiles-daemon-activation): New variable.
Change-Id: Ib035d993ed82eec2a43f3ba2b4c92f77e08a0fd7
---
gnu/services/pm.scm | 56 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm
index 3daf484cc1..bedeebb9d8 100644
--- a/gnu/services/pm.scm
+++ b/gnu/services/pm.scm
@@ -21,18 +21,72 @@ (define-module (gnu services pm)
#:use-module (guix packages)
#:use-module (guix records)
#:use-module (gnu packages admin)
+ #:use-module (gnu packages freedesktop)
#:use-module (gnu packages linux)
#:use-module (gnu services)
#:use-module (gnu services base)
#:use-module (gnu services configuration)
+ #:use-module (gnu services dbus)
#:use-module (gnu services shepherd)
#:use-module (gnu system shadow)
- #:export (tlp-service-type
+ #:export (power-profiles-daemon-service-type
+ power-profiles-daemon-configuration
+
+ tlp-service-type
tlp-configuration
thermald-configuration
thermald-service-type))
+;;;
+;;; power-profiles-daemon
+;;;
+
+(define-configuration/no-serialization power-profiles-daemon-configuration
+ (power-profiles-daemon
+ (file-like power-profiles-daemon)
+ "The power-profiles-daemon package."))
+
+(define (power-profiles-daemon-shepherd-service config)
+ (match-record
+ config <power-profiles-daemon-configuration>
+ (power-profiles-daemon)
+ (list (shepherd-service (provision '(power-profiles-daemon))
+ (requirement '(dbus-system))
+ (documentation "Run the power-profiles-daemon.")
+ (start #~(make-forkexec-constructor
+ (list #$(file-append power-profiles-daemon
+
"/libexec/power-profiles-daemon"))))
+ (stop #~(make-kill-destructor))))))
+
+(define %power-profiles-daemon-activation
+ #~(begin
+ (use-modules (guix build utils))
+ (mkdir-p "/var/lib/power-profiles-daemon")))
+
+(define power-profiles-daemon-service-type
+ (let ((config->package
+ (compose list
power-profiles-daemon-configuration-power-profiles-daemon)))
+ (service-type
+ (name 'power-profiles-daemon)
+ (extensions (list
+ (service-extension shepherd-root-service-type
+ power-profiles-daemon-shepherd-service)
+ (service-extension dbus-root-service-type
+ config->package)
+ (service-extension polkit-service-type
+ config->package)
+ (service-extension profile-service-type
+ config->package)
+ (service-extension activation-service-type
+ (const
%power-profiles-daemon-activation))))
+ (default-value (power-profiles-daemon-configuration))
+ (description "Run the power-profiles-daemon"))))
+
+;;;
+;;; tlp
+;;;
+
(define (uglify-field-name field-name)
(let ((str (symbol->string field-name)))
(string-join (string-split
--
2.41.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug#70460] [PATCH 4/4] gnu: services: Add power-profiles-daemon-service-type.,
Dariqq <=