1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-27 03:21:49 +02:00

gexp: Add 'scheme-file'.

* guix/gexp.scm (<scheme-file>): New record type.
  (scheme-file, scheme-file-compiler): New procedures.
* tests/gexp.scm ("scheme-file"): New test.
* doc/guix.texi (G-Expressions): Document 'scheme-file'.
This commit is contained in:
Ludovic Courtès
2015-09-16 15:03:52 +02:00
parent b893f1aec3
commit e1c153e0ab
3 changed files with 48 additions and 4 deletions
+13
View File
@@ -636,6 +636,19 @@
(return (and (zero? (close-pipe pipe))
(= n (string->number str)))))))))
(test-assertm "scheme-file"
(let* ((text (plain-file "foo" "Hello, world!"))
(scheme (scheme-file "bar" #~(list "foo" #$text))))
(mlet* %store-monad ((drv (lower-object scheme))
(text (lower-object text))
(out -> (derivation->output-path drv)))
(mbegin %store-monad
(built-derivations (list drv))
(mlet %store-monad ((refs ((store-lift references) out)))
(return (and (equal? refs (list text))
(equal? `(list "foo" ,text)
(call-with-input-file out read)))))))))
(test-assert "text-file*"
(let ((references (store-lift references)))
(run-with-store %store