From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cEs+EJapMGPwbAAAbAwnHQ (envelope-from ) for ; Sun, 25 Sep 2022 21:18:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cHs2EJapMGOoxQAA9RJhRA (envelope-from ) for ; Sun, 25 Sep 2022 21:18:46 +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 17F3F8FB0 for ; Sun, 25 Sep 2022 21:18:46 +0200 (CEST) Received: from localhost ([::1]:41718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocX9J-0005VZ-AT for larch@yhetil.org; Sun, 25 Sep 2022 15:18:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocX8X-0005V8-Q2; Sun, 25 Sep 2022 15:17:57 -0400 Received: from server0.selfhosted.xyz ([217.64.149.7]:37948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocX8V-0005vd-0I; Sun, 25 Sep 2022 15:17:57 -0400 Received: from server0.selfhosted.xyz (localhost [127.0.0.1]) by server0.selfhosted.xyz (Postfix) with ESMTP id 9B22F2C71D48; Sun, 25 Sep 2022 21:17:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=selfhosted.xyz; s=dkim; t=1664133462; bh=XglMmDt1ZcJXE8+/Pz7WHCBB+GNrbhhO0qu8R7sdOm0=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=uuu+k38GFtfUT1ULlJcx4h4ezG5yJUAXZTH5s8e0dn22jV5irXtN4PasbgiI6Vjge Fh0xpQFxKR0r54lM+1wcUjqB2lDMNSCmeldHbFi1VDyVPa4tCeBbf28puCIHpBEh+F uUZ5hD7E+l5StlOMdPc0EnVS/E3pz5c9tDVp6vNwexXnG5+Iu+caXRSvlOvqspevMU 6wZTGq+qopRtqJFx12uWS9ttnrn3934X3k3EFUS2/sOSEaK8x7G2CzYyHeJKbm85rj Imtt7ML9D0oKKwXmk3yDOLlKQPffVYzzY7Qa3JK6jED5haQ4hlzbrf7WlkEbYpB5lw 33ulbIxVnj/Jw== X-Fuglu-Suspect: ebb4662e421c465b8e970f398d7144d7 X-Fuglu-Spamstatus: NO Received: from webmail.selfhosted.xyz (office.selfhosted.xyz [192.168.1.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mail@selfhosted.xyz) by server0.selfhosted.xyz (Postfix) with ESMTPSA; Sun, 25 Sep 2022 21:17:36 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 25 Sep 2022 21:17:36 +0200 From: david larsson To: jgart Cc: Guix Devel , Guix-devel Subject: Re: What happens when you build a Guix package at every step? In-Reply-To: <20220925122824.GB30202@dismail.de> References: <20220925122824.GB30202@dismail.de> Message-ID: X-Sender: david.larsson@selfhosted.xyz Received-SPF: pass client-ip=217.64.149.7; envelope-from=david.larsson@selfhosted.xyz; helo=server0.selfhosted.xyz X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, FROM_SUSPICIOUS_NTLD=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_PDS_OTHER_BAD_TLD=0.01 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=1664133526; 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=XglMmDt1ZcJXE8+/Pz7WHCBB+GNrbhhO0qu8R7sdOm0=; b=CkntYDb/+bNDmoF5cWMjnrjtsBi2EJGGCFes8OSHMV7siUIAKxAHlff49+hhZPbvK+KONu ZqLTp+1BOxCmuYtyZAzaS6WqGPhhJkAsRMoOHZ1m5gEeKFFlvx58KEwbfN/wYfghnzrn7L MbN+U48ZKJAvU3zAVgALJmhfA6ewsPitFt7Q26Tu/oF7BDXoicrqTj3fq84qxfMkizpM16 5qf+LGSqgiEJsVNdS788DUnc9VNB14NZJ2sZy1sRwYHreKy3DhpWq/WXdZFP4V0PFLv8vP lfakaVzKryQm/gPZSY2n+PVOZKvDMTHsvpZm1ImK0s7mFNvSe/S6J3hyiep4hA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664133526; a=rsa-sha256; cv=none; b=uiGm3cNY0BspUWjlPGsfaz7X39HJP1redOPhslNhouxu/ew8usYifrQHg7HStTDbIDvZQN w5dzl/COHdOJOKd96pw05/uPcyycSCB3wFGfn1S/t+1/NIBFlyXnLGEydsaiQujQqDqn/M s+WXCz2exUDNqUPDGse7z0Ypbmr00aTwSHH800K7rR+bSsg+hIh4u82VWrlXxtjLBhkGdQ IUVvzbtvUpsOG3Maz596GlUDc9jygtMVxNWPpbVM4FQ4Hj33ghqBSNP0l5U8X+E8c8oBPd cIbFVMGbMDVNWHnYGuzGGFpLCynGWZZMbr0ZJlJ13lVgtdLFfvLd6Rp8QZpduA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=selfhosted.xyz header.s=dkim header.b=uuu+k38G; dmarc=pass (policy=none) header.from=selfhosted.xyz; 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: -3.55 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=selfhosted.xyz header.s=dkim header.b=uuu+k38G; dmarc=pass (policy=none) header.from=selfhosted.xyz; 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: 17F3F8FB0 X-Spam-Score: -3.55 X-Migadu-Scanner: scn1.migadu.com X-TUID: Ts1UOkTRrY8T 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) (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 = # /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