Subject: bug#75879: with-parameters does not work generally for packages

From: David Elsing <[email-masked]>
Date: Sun, 26 Jan 2025 21:11:07 +0000

Hello,

I noticed that 'with-parameters' from (guix gexp) does not work with
Guile parameters used in package definitions. They are still set
in 'lower-object', but not anymore when the monadic procedure returned
by 'lower-object' is evaluated.

Attached is an example for a package wrapped by 'with-parameters', which
results in a file with "D" instead of "C" (it is not "A", because the
'arguments' field of <package> is thunked).

Is this intentional? I'm not really sure how (or whether) this should be
changed though.

Best,
David

(use-modules
 (guix build-system trivial)
 (guix gexp)
 (guix derivations)
 (guix packages)
 (guix store)
 (gnu packages base))

(define %param
  (make-parameter "A"))

(define testp
  (package
    (name "testp")
    (version "0")
    (source #f)
    (build-system trivial-build-system)
    (arguments
     (list
      #:builder
      #~(let ((port (open-file (string-append #$output) "w")))
          (display (string-append #$(%param) "\n") port)
          (close-port port))))
    (home-page #f)
    (synopsis #f)
    (description #f)
    (license #f)))

(%param "B")

(define obj
  (with-parameters
      ((%param "C"))
    testp))

(%param "D")

obj