mirror of
https://gitlab.com/nonguix/nonguix.git
synced 2024-11-26 18:35:19 +01:00
e3896f51d2
* 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>
56 lines
2.2 KiB
Scheme
56 lines
2.2 KiB
Scheme
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
|
;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
|
|
|
|
(define-module (nongnu services nvidia)
|
|
#:use-module (guix gexp)
|
|
#:use-module (guix records)
|
|
#:use-module (gnu packages)
|
|
#:use-module (gnu packages linux)
|
|
#:use-module (gnu services)
|
|
#:use-module (gnu services base)
|
|
#:use-module (gnu services linux)
|
|
#:use-module (gnu services shepherd)
|
|
#:use-module (nongnu packages nvidia)
|
|
#:export (nvidia-configuration
|
|
nvidia-configuration?
|
|
nvidia-configuration-record?
|
|
nvidia-service-type))
|
|
|
|
(define-record-type* <nvidia-configuration>
|
|
nvidia-configuration make-nvidia-configuration
|
|
nvidia-configuration?
|
|
(driver nvidia-configuration-driver
|
|
(default nvda)) ; file-like
|
|
(firmware nvidia-configuration-firmware
|
|
(default nvidia-firmware)) ; file-like
|
|
(module nvidia-configuration-module
|
|
(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")))))))
|
|
|
|
(define nvidia-service-type
|
|
(service-type
|
|
(name 'nvidia)
|
|
(extensions
|
|
(list (service-extension shepherd-root-service-type
|
|
nvidia-shepherd-service)
|
|
(service-extension profile-service-type
|
|
(compose list nvidia-configuration-driver))
|
|
(service-extension udev-service-type
|
|
(compose list nvidia-configuration-driver))
|
|
(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")))))
|
|
(default-value (nvidia-configuration))
|
|
(description "Prepare system environment for NVIDIA driver.")))
|