Merge branch 'feat-declarative-nvidia-config' into 'master'
Support declarative nvidia configurations See merge request nonguix/nonguix!602
This commit is contained in:
commit
be06b67bd4
|
@ -22,3 +22,43 @@ Only x86_64-linux and i686-linux are supported.
|
||||||
(arguments `(#:system "i686-linux"
|
(arguments `(#:system "i686-linux"
|
||||||
,@(package-arguments package64)))))
|
,@(package-arguments package64)))))
|
||||||
(_ package64)))
|
(_ package64)))
|
||||||
|
|
||||||
|
(define* (with-transformation proc obj #:optional (pred package?))
|
||||||
|
"Recursing into child elements, apply PROC to every element of OBJ that matches
|
||||||
|
PRED."
|
||||||
|
(match obj
|
||||||
|
((? pred)
|
||||||
|
(proc obj))
|
||||||
|
((? procedure?)
|
||||||
|
(lambda args
|
||||||
|
(apply values
|
||||||
|
(map (cut with-transformation proc <> pred)
|
||||||
|
(call-with-values
|
||||||
|
(lambda ()
|
||||||
|
(apply obj args))
|
||||||
|
list)))))
|
||||||
|
((a . b)
|
||||||
|
(cons (with-transformation proc a pred)
|
||||||
|
(with-transformation proc b pred)))
|
||||||
|
((_ ...)
|
||||||
|
(map (cut with-transformation proc <> pred)
|
||||||
|
obj))
|
||||||
|
(#(_ ...)
|
||||||
|
(vector-map (lambda (vec elt)
|
||||||
|
(with-transformation proc elt pred))
|
||||||
|
obj))
|
||||||
|
;; `<service-type>' and `<origin>' record types are expected to not be
|
||||||
|
;; modified. Altering them causes very difficult to debug run-time errors.
|
||||||
|
((or (? service-type?)
|
||||||
|
(? origin?))
|
||||||
|
obj)
|
||||||
|
((? record?)
|
||||||
|
(let* ((record-type (record-type-descriptor obj))
|
||||||
|
(record-fields (record-type-fields record-type)))
|
||||||
|
(apply (record-constructor record-type)
|
||||||
|
(map (lambda (field)
|
||||||
|
(let* ((accessor (record-accessor record-type field))
|
||||||
|
(obj (accessor obj)))
|
||||||
|
(with-transformation proc obj pred)))
|
||||||
|
record-fields))))
|
||||||
|
(_ obj)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user