guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Viewing derivation output in the store


From: Brian Cully
Subject: Viewing derivation output in the store
Date: Wed, 20 Apr 2022 11:40:43 -0400
User-agent: mu4e 1.6.10; emacs 28.1

        I apologize if this isn’t the right place to ask these
questions. While this is on the level of beginner tutorial (or should
be, IMHO), the devel list seemed the most relevant.

        I’m trying to figure out how I can create a file and view it in
the store before installation. I’d like to make sure the target looks
the way I want before putting it in its final location. I would like to
do this entirely within a Geiser session, rather than having to call
shell commands for ease of edit-test-debug cycles and tracing.

        This is also for pedagogical purposes; I’m trying to learn how
Guix goes from abstract file-like-object to an actual file. I’m still
new to basically everything here, and exercises like this help me learn.

        So, given the following:

---[snip]---
(use-modules (guix)
             (guix gexp)
             (guix monads)
             (gnu))

(define test-file (plain-file "foo.txt" "the contents of foo"))
(define test-gexp #~(begin #$test-file))
(define test-drv (gexp->derivation "foo" test-gexp))
---[snip]---

        How do I go from the derivation in ’test-drv’ to the output in
the store? Something like how, from the REPL, this works:

---[snip]---
scheme@(guile-user)> ,enter-store-monad
store-monad@(guile-user) [1]> (text-file "foo" "hello")
$34 = "/gnu/store/mnzh1q6ilbw0bg04dg0vc4f47laz57lg-foo"
---[snip]---

        Now I can easily open the path to ’/gnu/store/…foo’ to verify
the contents are correct.

NB: While I’m using ’plain-file’ here and its conents are obvious, this
is just to keep things simple. My actual target comes from
’computed-file’.

-bjc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]