mirror of
https://gitlab.com/nonguix/nonguix.git
synced 2024-11-22 00:18:07 +01:00
nongnu: nvidia-driver: Simplify udev rules creation.
* nongnu/packages/nvidia.scm (nvidia-driver)[arguments]<#:phases>: Simplify udev rules creation. Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
parent
9f4e8e82f1
commit
fe9813a3ee
1 changed files with 11 additions and 17 deletions
|
@ -135,26 +135,20 @@
|
|||
|
||||
;; Add udev rules for nvidia
|
||||
(let ((rulesdir (string-append #$output "/lib/udev/rules.d/"))
|
||||
(rules (string-append #$output "/lib/udev/rules.d/90-nvidia.rules"))
|
||||
(sh (search-input-file inputs "/bin/sh"))
|
||||
(mknod (search-input-file inputs "/bin/mknod"))
|
||||
(cut (search-input-file inputs "/bin/cut"))
|
||||
(grep (search-input-file inputs "/bin/grep")))
|
||||
(rules (string-append #$output "/lib/udev/rules.d/90-nvidia.rules")))
|
||||
(mkdir-p rulesdir)
|
||||
(call-with-output-file rules
|
||||
(lambda (port)
|
||||
(put-string port
|
||||
(string-append
|
||||
"KERNEL==\"nvidia\", "
|
||||
"RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidiactl c $$(" grep " nvidia-frontend /proc/devices | " cut " -d \\ -f 1) 255'\"" "\n"
|
||||
"KERNEL==\"nvidia_modeset\", "
|
||||
"RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidia-modeset c $$(" grep " nvidia-frontend /proc/devices | " cut " -d \\ -f 1) 254'\"" "\n"
|
||||
"KERNEL==\"card*\", SUBSYSTEM==\"drm\", DRIVERS==\"nvidia\", "
|
||||
"RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidia0 c $$(" grep " nvidia-frontend /proc/devices | " cut " -d \\ -f 1) 0'\"" "\n"
|
||||
"KERNEL==\"nvidia_uvm\", "
|
||||
"RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidia-uvm c $$(" grep " nvidia-uvm /proc/devices | " cut " -d \\ -f 1) 0'\"" "\n"
|
||||
"KERNEL==\"nvidia_uvm\", "
|
||||
"RUN+=\"" sh " -c '" mknod " -m 666 /dev/nvidia-uvm-tools c $$(" grep " nvidia-uvm /proc/devices | " cut " -d \\ -f 1) 0'\"" "\n" )))))
|
||||
(put-string port (format #f "~
|
||||
KERNEL==\"nvidia\", RUN+=\"@sh@ -c '@mknod@ -m 666 /dev/nvidiactl c $$(@grep@ nvidia-frontend /proc/devices | @cut@ -d \\ -f 1) 255'\"
|
||||
KERNEL==\"nvidia_modeset\", RUN+=\"@sh@ -c '@mknod@ -m 666 /dev/nvidia-modeset c $$(@grep@ nvidia-frontend /proc/devices | @cut@ -d \\ -f 1) 254'\"
|
||||
KERNEL==\"card*\", SUBSYSTEM==\"drm\", DRIVERS==\"nvidia\", RUN+=\"@sh@ -c '@mknod@ -m 666 /dev/nvidia0 c $$(@grep@ nvidia-frontend /proc/devices | @cut@ -d \\ -f 1) 0'\"
|
||||
KERNEL==\"nvidia_uvm\", RUN+=\"@sh@ -c '@mknod@ -m 666 /dev/nvidia-uvm c $$(@grep@ nvidia-uvm /proc/devices | @cut@ -d \\ -f 1) 0'\"
|
||||
KERNEL==\"nvidia_uvm\", RUN+=\"@sh@ -c '@mknod@ -m 666 /dev/nvidia-uvm-tools c $$(@grep@ nvidia-uvm /proc/devices | @cut@ -d \\ -f 1) 0'\"
|
||||
"))))
|
||||
(substitute* rules
|
||||
(("@\\<(sh|grep|mknod|cut)\\>@" all cmd)
|
||||
(search-input-file inputs (string-append "/bin/" cmd)))))
|
||||
|
||||
;; ------------------------------
|
||||
;; Add a file to load nvidia drivers
|
||||
|
|
Loading…
Reference in a new issue