mirror of
https://gitlab.com/nonguix/nonguix.git
synced 2024-12-01 12:44:11 +01:00
services: nvidia: Adjust configuration options.
* nongnu/services/nvidia.scm (nvidia-configuration): [nvidia-driver]: Rename to ‘driver’. Default to nvda. Accept a file-like object. [nvidia-firmware]: Rename to ‘firmware’. Accept a file-like object. [nvidia-module]: Rename to ‘module’. Accept a file-like object. [modules]: Remove option. (nvidia-shepherd-service): Correct kernel module name. [stop]: Don't return #f. (nvidia-service-type): Extend profile-service-type with ‘driver’. Adjust accordingly. Signed-off-by: John Kehayias <john.kehayias@protonmail.com>
This commit is contained in:
parent
deab71dbe6
commit
e3896f51d2
1 changed files with 17 additions and 17 deletions
|
@ -2,14 +2,14 @@
|
||||||
;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
|
;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
|
||||||
|
|
||||||
(define-module (nongnu services nvidia)
|
(define-module (nongnu services nvidia)
|
||||||
|
#:use-module (guix gexp)
|
||||||
|
#:use-module (guix records)
|
||||||
#:use-module (gnu packages)
|
#:use-module (gnu packages)
|
||||||
#:use-module (gnu packages linux)
|
#:use-module (gnu packages linux)
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (gnu services base)
|
#:use-module (gnu services base)
|
||||||
#:use-module (gnu services linux)
|
#:use-module (gnu services linux)
|
||||||
#:use-module (gnu services shepherd)
|
#:use-module (gnu services shepherd)
|
||||||
#:use-module (guix gexp)
|
|
||||||
#:use-module (guix records)
|
|
||||||
#:use-module (nongnu packages nvidia)
|
#:use-module (nongnu packages nvidia)
|
||||||
#:export (nvidia-configuration
|
#:export (nvidia-configuration
|
||||||
nvidia-configuration?
|
nvidia-configuration?
|
||||||
|
@ -19,24 +19,22 @@
|
||||||
(define-record-type* <nvidia-configuration>
|
(define-record-type* <nvidia-configuration>
|
||||||
nvidia-configuration make-nvidia-configuration
|
nvidia-configuration make-nvidia-configuration
|
||||||
nvidia-configuration?
|
nvidia-configuration?
|
||||||
(nvidia-driver nvidia-configuration-nvidia-driver
|
(driver nvidia-configuration-driver
|
||||||
(default (list nvidia-driver))) ; list of file-like
|
(default nvda)) ; file-like
|
||||||
(nvidia-firmware nvidia-configuration-nvidia-firmware
|
(firmware nvidia-configuration-firmware
|
||||||
(default (list nvidia-firmware))) ; list of file-like
|
(default nvidia-firmware)) ; file-like
|
||||||
(nvidia-module nvidia-configuration-nvidia-module
|
(module nvidia-configuration-module
|
||||||
(default (list nvidia-module))) ; list of file-like
|
(default nvidia-module))) ; file-like
|
||||||
(modules nvidia-configuration-modules
|
|
||||||
(default (list "nvidia-uvm")))) ; list of string
|
|
||||||
|
|
||||||
(define (nvidia-shepherd-service config)
|
(define (nvidia-shepherd-service config)
|
||||||
(list (shepherd-service
|
(list (shepherd-service
|
||||||
(documentation "Unload nvidia-uvm module on powering off.")
|
(documentation "Prepare system environment for NVIDIA driver.")
|
||||||
(provision '(nvidia))
|
(provision '(nvidia))
|
||||||
(requirement '(user-processes))
|
(requirement '(user-processes))
|
||||||
(start #~(const #t))
|
(start #~(const #t))
|
||||||
(stop #~(lambda _
|
(stop #~(lambda _
|
||||||
(let ((rmmod #$(file-append kmod "/bin/rmmod")))
|
(let ((rmmod #$(file-append kmod "/bin/rmmod")))
|
||||||
(zero? (system* rmmod "nvidia-uvm"))))))))
|
(system* rmmod "nvidia_uvm")))))))
|
||||||
|
|
||||||
(define nvidia-service-type
|
(define nvidia-service-type
|
||||||
(service-type
|
(service-type
|
||||||
|
@ -44,13 +42,15 @@
|
||||||
(extensions
|
(extensions
|
||||||
(list (service-extension shepherd-root-service-type
|
(list (service-extension shepherd-root-service-type
|
||||||
nvidia-shepherd-service)
|
nvidia-shepherd-service)
|
||||||
|
(service-extension profile-service-type
|
||||||
|
(compose list nvidia-configuration-driver))
|
||||||
(service-extension udev-service-type
|
(service-extension udev-service-type
|
||||||
nvidia-configuration-nvidia-driver)
|
(compose list nvidia-configuration-driver))
|
||||||
(service-extension firmware-service-type
|
(service-extension firmware-service-type
|
||||||
nvidia-configuration-nvidia-firmware)
|
(compose list nvidia-configuration-firmware))
|
||||||
(service-extension linux-loadable-module-service-type
|
(service-extension linux-loadable-module-service-type
|
||||||
nvidia-configuration-nvidia-module)
|
(compose list nvidia-configuration-module))
|
||||||
(service-extension kernel-module-loader-service-type
|
(service-extension kernel-module-loader-service-type
|
||||||
nvidia-configuration-modules)))
|
(const '("nvidia_uvm")))))
|
||||||
(default-value (nvidia-configuration))
|
(default-value (nvidia-configuration))
|
||||||
(description "Load NVIDIA modules.")))
|
(description "Prepare system environment for NVIDIA driver.")))
|
||||||
|
|
Loading…
Reference in a new issue