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
|
;;; 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)
|
(define-module (nongnu services nvidia)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
|
@ -27,14 +27,20 @@
|
||||||
(default nvidia-module))) ; file-like
|
(default nvidia-module))) ; file-like
|
||||||
|
|
||||||
(define (nvidia-shepherd-service config)
|
(define (nvidia-shepherd-service config)
|
||||||
(list (shepherd-service
|
(let ((nvidia-driver (nvidia-configuration-driver config))
|
||||||
(documentation "Prepare system environment for NVIDIA driver.")
|
(nvidia-smi (file-append nvidia-driver "/bin/nvidia-smi"))
|
||||||
(provision '(nvidia))
|
(rmmod (file-append kmod "/bin/rmmod")))
|
||||||
(requirement '(user-processes))
|
(list (shepherd-service
|
||||||
(start #~(const #t))
|
(documentation "Prepare system environment for NVIDIA driver.")
|
||||||
(stop #~(lambda _
|
(provision '(nvidia))
|
||||||
(let ((rmmod #$(file-append kmod "/bin/rmmod")))
|
(requirement '(udev user-processes))
|
||||||
(system* rmmod "nvidia_uvm")))))))
|
(start
|
||||||
|
#~(lambda _
|
||||||
|
(when (file-exists? #$nvidia-smi)
|
||||||
|
(system* #$nvidia-smi))))
|
||||||
|
(stop
|
||||||
|
#~(lambda _
|
||||||
|
(system* #$rmmod "nvidia_uvm")))))))
|
||||||
|
|
||||||
(define nvidia-service-type
|
(define nvidia-service-type
|
||||||
(service-type
|
(service-type
|
||||||
|
|
Loading…
Reference in a new issue