Am Mittwoch, dem 15.01.2025 um 15:28 +0100 schrieb pelzflorian (Florian
Pelz):
> Is it better to wrap viewnior and hard-code the supported image
> formats, as I wanted, so installing only viewnior is enough?
>
> Or better drop the attached patch and users need to install gdk-
> pixbuf [and] webp-pixbuf-loader as well?
>
> I tend to prefer to wrap viewnior.
I think wrapping is good, but I don't think we can anticipate all the
formats a user might want. I've attached a patch that allows us to use
"set if unspecified" semantics – not really sure how meaningful those
are – but perhaps we would need a GUIX_-prefixed environment variable
once again. Barring an upstream change from GDK_PIXBUF_MODULE_FILE to
GDK_PIXBUF_MODULE_PATH anyway.
WDYT?
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 94714bf397..d48b9112b8 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -1393,6 +1393,9 @@ (define* (wrap-program prog #:key (sh (which "bash")) #:rest vars)
((var sep '= rest)
(format #f "export ~a=\"~a\""
var (string-join rest sep)))
+ ((var sep ':- rest)
+ (format #f "export ~a=\"${~a:-~a}\""
+ var var (string-join rest sep)))
((var sep 'prefix rest)
(format #f "export ~a=\"~a${~a:+~a}$~a\""
var (string-join rest sep) var sep var))
@@ -1402,6 +1405,9 @@ (define* (wrap-program prog #:key (sh (which "bash")) #:rest vars)
((var '= rest)
(format #f "export ~a=\"~a\""
var (string-join rest ":")))
+ ((var ':- rest)
+ (format #f "export ~a=\"${~a:-~a}\""
+ var var (string-join rest ":")))
((var 'prefix rest)
(format #f "export ~a=\"~a${~a:+:}$~a\""
var (string-join rest ":") var var))
@@ -1470,6 +1476,8 @@ (define wrap-script
(match-lambda
((var sep '= rest)
`(setenv ,var ,(string-join rest sep)))
+ ((var sep ':- rest)
+ `(unless (getenv ,var) (setenv ,var ,(string-join rest sep))))
((var sep 'prefix rest)
`(let ((current (getenv ,var)))
(setenv ,var (if current
@@ -1484,6 +1492,8 @@ (define wrap-script
,(string-join rest sep)))))
((var '= rest)
`(setenv ,var ,(string-join rest ":")))
+ ((var ':- rest)
+ `(unless (getenv ,var) (setenv ,var ,(string-join rest ":"))))
((var 'prefix rest)
`(let ((current (getenv ,var)))
(setenv ,var (if current