From: jbranso@dismail.de
To: "david larsson" <david.larsson@selfhosted.xyz>,
"jgart" <jgart@dismail.de>
Cc: "Guix Devel" <guix-devel@gnu.org>,
"Guix-devel"
<guix-devel-bounces+david.larsson=selfhosted.xyz@gnu.org>
Subject: Re: What happens when you build a Guix package at every step?
Date: Mon, 26 Sep 2022 21:03:20 +0000 [thread overview]
Message-ID: <ca0c72b5dfcbee2b268b0845ac66dda0@dismail.de> (raw)
In-Reply-To: <df87b93bedb58101e93653a37d1e53c6@selfhosted.xyz>
September 25, 2022 3:18 PM, "david larsson" <david.larsson@selfhosted.xyz> wrote:
> On 2022-09-25 19:28, jgart wrote:
>
>> What would be the best way to illustrate the levels of nesting and code
>> paths that get traversed when building a Guix package?
>> I'd like to make some sequence diagram notation or something else to
>> better understand what happens in a visual way.
>> wdyt
>
> I like your idea! I'm probably not the most qualified person to answer it, since I am (also?)
> mainly using guix as a sparetime "hobby", but still very interested in learning more about it on a
> deeper level, which is a challenge. Some visual aids would definitely be helpful.
>
> I think a shell of an answer would be to link together the following things in such a diagram:
>
> 1. gexps
> 2. the store
> 3. derivations
> 4. build systems
> 5. a package
>
> Building a package in the repl, kind of illustrates the code paths via code modules used:
>
> scheme@(guix-user)> ,use (guix gexp)
> scheme@(guix-user)> ,use (guix store)
> scheme@(guix-user)> ,use (guix derivations)
> scheme@(guix-user)> ,use (gnu packages bash)
>
> However, in my opinion, the reason we look for the diagram is partially bcs of that the concepts of
> the related things are relatively high level so that it takes a while to grasp them, just like
> monads or maybe higher order functions.
>
> However, to continue the repl example:
>
> scheme@(guix-user)> (define (sh-symlink)
> (gexp->derivation "sh"
> #~(symlink (string-append #$bash "/bin/bash")
> #$output)))
> scheme@(guix-user)> (build-derivations (open-connection) `(,(run-with-store (open-connection)
I think you can also do a
,build derivation
This link has more info:
https://issues.guix.gnu.org/56114
> (sh-symlink))))
> $1 = #t
>
> Now if you run just the (run-with-store (open-connection) (sh-symlink)) you will see the derivation
> path output, and if you then open a new terminal you can cat
> /gnu/store/shcvi6d1vgry26sq1i3qdmgsmh0n6wmi-sh.drv to see the build script without building it.
>
> Now, to build a "package" after above code is loaded:
> scheme@(guix-user)> ,use (guix packages)
> scheme@(guix-user)> (build-derivations (open-connection) `(,(package-derivation (open-connection)
> bash)))
> substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
> fetching path `/gnu/store/vk4r0x7baig8jnmsqrgrqpyq8qxr4gm3-bash-5.0.16-doc'...
> Downloading https://ci.guix.gnu.org/nar/lzip/vk4r0x7baig8jnmsqrgrqpyq8qxr4gm3-bash-5.0.16-doc...
> bash-5.0.16-doc 290KiB 750KiB/s 00:00 [##################] 100.0%
> $2 = #t
>
> And to only "inspect" it (so you can cat the /gnu/store/paths):
> scheme@(guix-user)> (package-derivation (open-connection) bash)
> $4 = #<derivation /gnu/store/cklj3xvrzrc930qwj1brmwr2dz4zbgd6-bash-5.0.16.drv =>
> /gnu/store/vk4r0x7baig8jnmsqrgrqpyq8qxr4gm3-bash-5.0.16-doc
> /gnu/store/v1xc4405s7xilmwhhkdj8z55wa2wlr8y-bash-5.0.16-include
> /gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16 7fc3d283e500>
>
> Concepts:
> - code staging or "delayed evaluation" concepts
> - what is the store and what is a build environment
> - what is a derivation
> - and finally build systems (normal build steps) and a package (incl. dependency graphs).
>
> The start reference point: https://guix.gnu.org/manual/en/html_node/Defining-Packages.html
>
> I hope above helps.
>
> Best regards,
> David
next prev parent reply other threads:[~2022-09-26 21:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-25 17:28 What happens when you build a Guix package at every step? jgart
2022-09-25 19:17 ` david larsson
2022-09-26 21:03 ` jbranso [this message]
2022-09-29 17:00 ` david larsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca0c72b5dfcbee2b268b0845ac66dda0@dismail.de \
--to=jbranso@dismail.de \
--cc=david.larsson@selfhosted.xyz \
--cc=guix-devel-bounces+david.larsson=selfhosted.xyz@gnu.org \
--cc=guix-devel@gnu.org \
--cc=jgart@dismail.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).