From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2HZPNIMUMmMYlQAAbAwnHQ (envelope-from ) for ; Mon, 26 Sep 2022 23:07:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MJ1oM4MUMmOO3wAAG6o9tA (envelope-from ) for ; Mon, 26 Sep 2022 23:07:15 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6BBA94794 for ; Mon, 26 Sep 2022 23:07:15 +0200 (CEST) Received: from localhost ([::1]:58436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocvJq-00006V-F3 for larch@yhetil.org; Mon, 26 Sep 2022 17:07:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocvGI-00062C-R6; Mon, 26 Sep 2022 17:03:35 -0400 Received: from mx1.dismail.de ([78.46.223.134]:19632) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocvGG-0000Gr-4M; Mon, 26 Sep 2022 17:03:34 -0400 Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id bac9c645; Mon, 26 Sep 2022 23:03:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h= mime-version:date:content-type:content-transfer-encoding:from :message-id:subject:to:cc:in-reply-to:references; s=20190914; bh=y7Pqg4TNGUX23RLy4njqwycAM/bHDwK789W8UDO/grs=; b=q3w7kfvh0m/y k2BQxGrA+t3eKDthfXtWowvNa3rvmCLiUySzJgKQO3zOxgkp9oEsBXGg3w6no1hl slJXQIHN7V5hPDo48CupXIayLCKSnuLG9Ckm4Oi4ctx1ntY6JKDmn5sbPf6LXET9 vQnXvTIr/B76DbIFrNpvlsVA5bAiRzdVKW9iwTTfvZWmTiXGk+UPrWymdcGoiurn RBrvyXSh/jceJ+pNYpXBQO5Abvox7QTmw2mzumKIPnVRChc45+vl4zETDsxq62Kj pK9BaX/UN/8VqPcZeTlPIF4NkUpbg5+djedtvhZ3fzfYiV076aV5ReduU+6yB8/6 5aEBPu40gA== Received: from smtp1.dismail.de ( [10.240.26.11]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 2f56e8f4; Mon, 26 Sep 2022 23:03:22 +0200 (CEST) Received: from smtp1.dismail.de (localhost [127.0.0.1]) by smtp1.dismail.de (OpenSMTPD) with ESMTP id 3e06fbf1; Mon, 26 Sep 2022 23:03:22 +0200 (CEST) Received: by dismail.de (OpenSMTPD) with ESMTPSA id 9b0f3481 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 26 Sep 2022 23:03:21 +0200 (CEST) MIME-Version: 1.0 Date: Mon, 26 Sep 2022 21:03:20 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: RainLoop/1.16.0a From: jbranso@dismail.de Message-ID: Subject: Re: What happens when you build a Guix package at every step? To: "david larsson" , "jgart" Cc: "Guix Devel" , "Guix-devel" In-Reply-To: References: <20220925122824.GB30202@dismail.de> Received-SPF: pass client-ip=78.46.223.134; envelope-from=jbranso@dismail.de; helo=mx1.dismail.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664226435; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=y7Pqg4TNGUX23RLy4njqwycAM/bHDwK789W8UDO/grs=; b=Rc8wn5WVhOWxT6dCSTrSXMIrVAvtpUHTULeDYSq7X1jlRd9L7XLF8l7LA07UX7i14Y/+mx 2kU8Y5ztbrcQ12r7BoPT96YrOm2FlN4HQEi+AB/X14T49gTejlkNZG3JzsCibRH9KT+MW6 lJXrh1r0WnuYoi4SNCE8Hvmrk3pxhV+dAhsdzdyQHNmg7cHIyiqxNe5gMi7NuVn9pCtECj 8cnKgz3JfRDcm1+nDe+4ozNGz2+J/DQTzrlweRt78Rv90Wu8evx1Ho6i96GU9GNbLS6Kqd vyAMzTs85uwq8JZEIPqW7bqowMYFZnGekKHxDe1NojqATzOsRhWrUlx3bCJ/6g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664226435; a=rsa-sha256; cv=none; b=Q/YGnNVJUEbtuYEsy6BpHiQEFmhsBG+j0yK6kZ/VeGxy/803xo61fvaKd9wanPD3UB87IU l2mVPa2HhQJtCyO8586vgWRc+dn6Np/nabXIiR8IInPTziras9REQ3Vdx3u3Np91PQ3jFj s4B1yR/4qzIeFSJ0Rl5upRBRLUAG91kKDmdDYIKp8dLmIIPuHv0oHZbW7FRe2/wTsT/yCm liXpjia9MCYzi5136a5FDqxvMaD7AbBpyRAChrpTHidC2ZV5yU6rfcmxz3ABSKAjXkyB0Y qpBPLnsskDkXTTOkZkOEl0AFqczShpahMYHBGF+st9Tl4WtDczqGr5SudpM66g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=dismail.de header.s=20190914 header.b=q3w7kfvh; dmarc=pass (policy=reject) header.from=dismail.de; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.34 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=dismail.de header.s=20190914 header.b=q3w7kfvh; dmarc=pass (policy=reject) header.from=dismail.de; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 6BBA94794 X-Spam-Score: -5.34 X-Migadu-Scanner: scn0.migadu.com X-TUID: cqbuAqrF8pRV September 25, 2022 3:18 PM, "david larsson" wrote: > On 2022-09-25 19:28, jgart wrote: >=20 >>=20What would be the best way to illustrate the levels of nesting and c= ode >> 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 >=20 >=20I like your idea! I'm probably not the most qualified person to answe= r 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 b= e helpful. >=20 >=20I think a shell of an answer would be to link together the following = things in such a diagram: >=20 >=201. gexps > 2. the store > 3. derivations > 4. build systems > 5. a package >=20 >=20Building a package in the repl, kind of illustrates the code paths vi= a code modules used: >=20 >=20scheme@(guix-user)> ,use (guix gexp) > scheme@(guix-user)> ,use (guix store) > scheme@(guix-user)> ,use (guix derivations) > scheme@(guix-user)> ,use (gnu packages bash) >=20 >=20However, in my opinion, the reason we look for the diagram is partial= ly bcs of that the concepts of > the related things are relatively high level so that it takes a while t= o grasp them, just like > monads or maybe higher order functions. >=20 >=20However, to continue the repl example: >=20 >=20scheme@(guix-user)> (define (sh-symlink) > (gexp->derivation "sh" > #~(symlink (string-append #$bash "/bin/bash") > #$output))) > scheme@(guix-user)> (build-derivations (open-connection) `(,(run-with-s= tore (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 =3D #t >=20 >=20Now 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 scr= ipt without building it. >=20 >=20Now, to build a "package" after above code is loaded: > scheme@(guix-user)> ,use (guix packages) > scheme@(guix-user)> (build-derivations (open-connection) `(,(package-de= rivation (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/vk4r0x7baig8jnmsqrgrqpyq8q= xr4gm3-bash-5.0.16-doc... > bash-5.0.16-doc 290KiB 750KiB/s 00:00 [##################] 100.0% > $2 =3D #t >=20 >=20And to only "inspect" it (so you can cat the /gnu/store/paths): > scheme@(guix-user)> (package-derivation (open-connection) bash) > $4 =3D # > /gnu/store/vk4r0x7baig8jnmsqrgrqpyq8qxr4gm3-bash-5.0.16-doc > /gnu/store/v1xc4405s7xilmwhhkdj8z55wa2wlr8y-bash-5.0.16-include > /gnu/store/87kif0bpf0anwbsaw0jvg8fyciw4sz67-bash-5.0.16 7fc3d283e500> >=20 >=20Concepts: > - 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. d= ependency graphs). >=20 >=20The start reference point: https://guix.gnu.org/manual/en/html_node/D= efining-Packages.html >=20 >=20I hope above helps. >=20 >=20Best regards, > David