mirror of
https://gitlab.com/nonguix/nonguix.git
synced 2024-11-22 00:18:07 +01:00
services: nvidia: Only invoke commands when NVIDIA driver is in use.
* nongnu/services/nvidia.scm (nvidia-service-type): Don't extend kernel-module-loader-service-type, move this part to… (nvidia-shepherd-service)[start]: …here. Check driver and command availablity. [stop]: Likewise. [modules]: Add (guix build utils) for ‘invoke/quiet’. Add (rnrs io ports) for ‘get-line’. Signed-off-by: John Kehayias <john.kehayias@protonmail.com>
This commit is contained in:
parent
97925d2091
commit
8a56ebb666
1 changed files with 10 additions and 5 deletions
|
@ -34,10 +34,17 @@
|
|||
(provision '(nvidia))
|
||||
(requirement '(udev))
|
||||
(one-shot? #t)
|
||||
(modules '(((guix build utils) #:select (invoke/quiet))
|
||||
((rnrs io ports) #:select (get-line))))
|
||||
(start
|
||||
#~(lambda _
|
||||
(when (file-exists? #$nvidia-smi)
|
||||
(system* #$nvidia-smi))))))))
|
||||
(when (file-exists? "/proc/driver/nvidia")
|
||||
(let ((modprobe (call-with-input-file
|
||||
"/proc/sys/kernel/modprobe" get-line)))
|
||||
(false-if-exception
|
||||
(begin
|
||||
(invoke/quiet modprobe "--" "nvidia_uvm")
|
||||
(invoke/quiet #$nvidia-smi)))))))))))
|
||||
|
||||
(define nvidia-service-type
|
||||
(service-type
|
||||
|
@ -52,8 +59,6 @@
|
|||
(service-extension firmware-service-type
|
||||
(compose list nvidia-configuration-firmware))
|
||||
(service-extension linux-loadable-module-service-type
|
||||
(compose list nvidia-configuration-module))
|
||||
(service-extension kernel-module-loader-service-type
|
||||
(const '("nvidia_uvm")))))
|
||||
(compose list nvidia-configuration-module))))
|
||||
(default-value (nvidia-configuration))
|
||||
(description "Prepare system environment for NVIDIA driver.")))
|
||||
|
|
Loading…
Reference in a new issue