mirror of
https://gitlab.com/nonguix/nonguix.git
synced 2024-11-25 09:58:09 +01:00
services: nvidia: Create extra device nodes on boot.
* nongnu/services/nvidia.scm (nvidia-shepherd-service) [requirement]: Add udev. [start]: Create extra device nodes via ‘nvidia-smi’. Signed-off-by: John Kehayias <john.kehayias@protonmail.com>
This commit is contained in:
parent
e3896f51d2
commit
e4e34b7da4
1 changed files with 15 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
|
||||
;;; Copyright © 2022, 2024 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (nongnu services nvidia)
|
||||
#:use-module (guix gexp)
|
||||
|
@ -27,14 +27,20 @@
|
|||
(default nvidia-module))) ; file-like
|
||||
|
||||
(define (nvidia-shepherd-service config)
|
||||
(list (shepherd-service
|
||||
(documentation "Prepare system environment for NVIDIA driver.")
|
||||
(provision '(nvidia))
|
||||
(requirement '(user-processes))
|
||||
(start #~(const #t))
|
||||
(stop #~(lambda _
|
||||
(let ((rmmod #$(file-append kmod "/bin/rmmod")))
|
||||
(system* rmmod "nvidia_uvm")))))))
|
||||
(let ((nvidia-driver (nvidia-configuration-driver config))
|
||||
(nvidia-smi (file-append nvidia-driver "/bin/nvidia-smi"))
|
||||
(rmmod (file-append kmod "/bin/rmmod")))
|
||||
(list (shepherd-service
|
||||
(documentation "Prepare system environment for NVIDIA driver.")
|
||||
(provision '(nvidia))
|
||||
(requirement '(udev user-processes))
|
||||
(start
|
||||
#~(lambda _
|
||||
(when (file-exists? #$nvidia-smi)
|
||||
(system* #$nvidia-smi))))
|
||||
(stop
|
||||
#~(lambda _
|
||||
(system* #$rmmod "nvidia_uvm")))))))
|
||||
|
||||
(define nvidia-service-type
|
||||
(service-type
|
||||
|
|
Loading…
Reference in a new issue