thinkfan-service-type: Move service to (radix services pm)
parent
4dbfc6d3f6
commit
5814fb56bc
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix services linux)
|
||||
(define-module (radix services pm)
|
||||
#:use-module (radix packages linux)
|
||||
#:use-module (gnu)
|
||||
#:use-module (gnu services)
|
||||
|
@ -19,12 +19,16 @@
|
|||
thinkfan-shepherd-service
|
||||
thinkfan-service-type))
|
||||
|
||||
(define (string-or-file-like? x)
|
||||
(or (string? x)
|
||||
(file-like? x)))
|
||||
|
||||
(define-configuration/no-serialization thinkfan-configuration
|
||||
(pid-file
|
||||
(string "/var/run/thinkfan.pid")
|
||||
"Where to store the PID file.")
|
||||
(config-file
|
||||
(string "/etc/thinkfan.conf")
|
||||
(string-or-file-like "/etc/thinkfan.conf")
|
||||
"Configuration file to use.")
|
||||
(log-file
|
||||
(string "/var/log/thinkfan.log")
|
||||
|
@ -60,12 +64,23 @@ arbitrary command-line arguments to ‘thinkfan’ as a list of strings."))
|
|||
(define (thinkfan-modprobe-etc-service config)
|
||||
`(("modprobe.d/thinkfan.conf" ,thinkfan-modprobe-config)))
|
||||
|
||||
(define thinkfan-activation
|
||||
(match-record-lambda <thinkfan-configuration>
|
||||
(config-file)
|
||||
(when (file-like? config-file)
|
||||
(with-imported-modules '((guix build utils))
|
||||
#~(begin
|
||||
(use-modules (guix build utils))
|
||||
(copy-file #$config-file "/etc/thinkfan.conf"))))))
|
||||
|
||||
(define thinkfan-service-type
|
||||
(service-type
|
||||
(name 'thinkfan)
|
||||
(extensions
|
||||
(list (service-extension shepherd-root-service-type
|
||||
thinkfan-shepherd-service)
|
||||
(service-extension activation-service-type
|
||||
thinkfan-activation)
|
||||
(service-extension etc-service-type
|
||||
thinkfan-modprobe-etc-service)))
|
||||
(default-value (thinkfan-configuration))
|
Loading…
Reference in New Issue