1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 13:10:33 +02:00

gexp: Add 'delayed-object'.

* guix/gexp.scm (<delayed-object>): New record type.
(delayed-object): New macro.
(delayed-object-compiler): New gexp compiler.
* tests/gexp.scm ("delayed-object"): New test.
* doc/guix.texi (G-Expressions): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
David Elsing
2026-02-03 21:33:21 +01:00
committed by Ludovic Courtès
parent 7d1b86859b
commit 96bd726277
3 changed files with 45 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014-2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2026 David Elsing <david.elsing@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -518,6 +519,20 @@
(return (and (eq? drv0 result0)
(eq? drv1 result1)))))
(test-assertm "delayed-object"
(let ((evaluated #f))
(mlet* %store-monad ((drv (package->derivation coreutils))
(obj -> (delayed-object
(begin
(set! evaluated #t)
coreutils)))
(first-evaluated -> evaluated)
(result (lower-object obj)))
(return (and (string=? (derivation-file-name drv)
(derivation-file-name result))
(not first-evaluated)
evaluated)))))
(test-assert "with-parameters + file-append"
(let* ((system (match (%current-system)
("aarch64-linux" "x86_64-linux")