From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 2AtsBRyc6GUxOQEAqHPOHw:P1 (envelope-from ) for ; Wed, 06 Mar 2024 17:38:52 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 2AtsBRyc6GUxOQEAqHPOHw (envelope-from ) for ; Wed, 06 Mar 2024 17:38:52 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=DWL6SBtM; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1709743131; 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:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=MRlivkXSHLGcv1R/ZMqxmB7AGPEO1DxleYzBxawjSLg=; b=GrbGSJhPr+A60BU8SJ7zcnp/xOf/1eKD8hBEXu2ZtnG15MYzcHOhOh7J0r2UDsLmQnCItv EfmHYcXiKSJwn9oz2XHU3kRryoYsGhdTD2HbM1fRXpf2qeqgS/aJsgsngGh2VBkqwsm1fI Rggqhokq1Gjcm2wSPdKmHxc7YFLC6WuB4yMr1FmHRmeCREYjcs1mMAqfXA/DMkpPjn+osP Ur17o2bFspxPPVbVkhD3f0wIopFHJgqqNWMMjyJI5+EuRQ0TM/BR9hWTtIyhRAzgeAh3Qx hIctIunkj62dIpZD8qkXw05PJNMn9UuDzlAFyelabIGxLjmUrl0c/xsB7eKtcQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=DWL6SBtM; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1709743131; a=rsa-sha256; cv=none; b=lGJRVHDTI9DFGvvj3Sk2QoIJhQbwjf3i3w4e62qJ2yukgiSzxB5ijQbU+8oyDzsBBkIFdo JVQ3JSb8k272d6jHsfL69XG7Hb7JtGxvr814AWPQ2mWoi0VCQvCp4DjPOlRLl3T/7fRF7j lVvAMU4y2UY8ykjV+WD9gsjHebhdb36bOrfVcci3Yi/km50Ze1Uiva5nnhApgl7q4VK1Yp g0UcqiFF66fmjNIi8BLcEPrM4W+sz3TCgrsnuu/72aA83lS0SHI/zvM7iikbisMZrGibrY 2TQdNm6c1I+sxNbB3vQ519dCKhq/S0Qk76zb/qcbsiKdNrqPG4jvAmgM8sCBfQ== 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 974634033D for ; Wed, 6 Mar 2024 17:38:51 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhuHp-0001wj-CO; Wed, 06 Mar 2024 11:38:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhuHo-0001vx-AP for guix-patches@gnu.org; Wed, 06 Mar 2024 11:38:32 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhuHo-0001LN-2M for guix-patches@gnu.org; Wed, 06 Mar 2024 11:38:32 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rhuII-0003EC-7t for guix-patches@gnu.org; Wed, 06 Mar 2024 11:39:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69587] [PATCH] doc: Add =?UTF-8?Q?=E2=80=9CSource?= Tree =?UTF-8?Q?Structure=E2=80=9D?= section. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Mar 2024 16:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69587 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69587@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170974311912378 (code B ref -1); Wed, 06 Mar 2024 16:39:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Mar 2024 16:38:39 +0000 Received: from localhost ([127.0.0.1]:51296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhuHs-0003DX-H8 for submit@debbugs.gnu.org; Wed, 06 Mar 2024 11:38:39 -0500 Received: from lists.gnu.org ([209.51.188.17]:45338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhuHo-0003DK-7R for submit@debbugs.gnu.org; Wed, 06 Mar 2024 11:38:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhuHI-0001cz-Lk for guix-patches@gnu.org; Wed, 06 Mar 2024 11:38:00 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhuHG-00014F-KB; Wed, 06 Mar 2024 11:37:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=MRlivkXSHLGcv1R/ZMqxmB7AGPEO1DxleYzBxawjSLg=; b=DWL6SBtM7cQE6n 6LkXR9rdpJpOx4lQhcXUUaeJTA7p/sCm4AItP9C2Q3ijSnVEV5QvyHD8lKGoa7itFWw4aKxkaGp6C bCl11NDgtDtrkaKCQTw/GxFuB/VXrSsMwm/fheiWvy/ae3cajdWIzKqYUfLSrJPehY2FzA3W1aTqB d+ITAZgLovqcoBCeo5C64L0NlEFHCHf3vYWh23MbCgMwrimvbiPUrqd+t9pOzexsmkoH6Foe2kHBT mVmGok7LCa3w6zfsd1XWCAnvDiHkf5IekpeL+ypewAnquCvqncb2U0LWgc5fXd6MrnBBtMki1JQZo uabO2fMwHvHfFVfSDfvw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 6 Mar 2024 17:37:47 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.17 X-Spam-Score: -6.17 X-Migadu-Queue-Id: 974634033D X-Migadu-Scanner: mx13.migadu.com X-TUID: R1QsPK24Rs3W * doc/contributing.texi (Source Tree Structure): New node. * doc/guix.texi (Programming Interface): Add cross-reference. Change-Id: I141a1f4d806ae5f72c7a246e18c14dc63056a607 --- doc/contributing.texi | 235 +++++++++++++++++++++++++++++++++++++++++- doc/guix.texi | 3 +- 2 files changed, 236 insertions(+), 2 deletions(-) Hello there! This is a long overdue section for contributors, very much inspired by Josselin's talk last year: https://10years.guix.gnu.org/video/guixy-guile-the-derivation-factory-a-tour-of-the-guix-source-tree/ Thoughts? Ludo'. diff --git a/doc/contributing.texi b/doc/contributing.texi index a7d91724fb..ff7065ad2a 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -23,7 +23,8 @@ Contributing * Building from Git:: The latest and greatest. * Running Guix Before It Is Installed:: Hacker tricks. * The Perfect Setup:: The right tools. -* Alternative Setups:: Other posible tools that do the job. +* Alternative Setups:: Other possible tools that do the job. +* Source Tree Structure:: Source code guided tour. * Packaging Guidelines:: Growing the distribution. * Coding Style:: Hygiene of the contributor. * Submitting Patches:: Share your work. @@ -546,6 +547,238 @@ Vim and NeoVim process and inject your code there live (sadly it's not packaged in Guix yet). +@node Source Tree Structure +@section Source Tree Structure + +@cindex structure, of the source tree +Now that we're all set, let's look at the source tree. Overall, the +Guix source tree contains almost exclusively Guile @dfn{modules}, each +of which can be seen as an independent library (@pxref{Modules,,, guile, +GNU Guile Reference Manual}). + +The following table gives an overview of the main directories and what +they contain. Remember that in Guile, each module name is derived from +its file name---e.g., the module in file@file{guix/packages.scm} is +called @code{(guix packages)}. + +@table @file +@item guix +This is the location of core Guix mechanisms. A few examples: + +@table @code +@item (guix store) +Connecting to and interacting with the build daemon (@pxref{The Store}). +@item (guix derivations) +Creating derivations (@pxref{Derivations}). +@item (guix gexps) +Writing G-expressions (@pxref{G-Expressions}). +@item (guix packages) +Defining packages and origins (@pxref{package Reference}). +@item (guix download) +@itemx (guix git-download) +The @code{url-fetch} and @code{git-fetch} origin download methods +(@pxref{origin Reference}). +@item (guix swh) +Fetching source code from the +@uref{https://archive.softwareheritage.org,Software Heritage archive}. +@item (guix search-paths) +Implementing search paths (@pxref{Search Paths}). +@item (guix build-system) +The build system interface (@pxref{Build Systems}). +@item (guix profiles) +Implementing profiles. +@end table + +@cindex build system, directory structure +@item guix/build-system +This directory contains specific build system implementations +(@pxref{Build Systems}), such as: + +@table @code +@item (guix build-system gnu) +the GNU build system; +@item (guix build-system cmake) +the CMake build system; +@item (guix build-system pyproject) +The Python ``pyproject'' build system. +@end table + +@item guix/build +This contains code generally used on the ``build side'' +(@pxref{G-Expressions, strata of code}). This includes code used to +build packages or other operating system components, as well as +utilities: + +@table @code +@item (guix build utils) +Utilities for package definitions and more (@pxref{Build Utilities}). +@item (guix build gnu-build-system) +@itemx (guix build cmake-build-system) +@itemx (guix build pyproject-build-system) +Implementation of build systems, and in particular definition of their +build phases (@pxref{Build Phases}). +@item (guix build syscalls) +Interface to the C library and to Linux system calls. +@end table + +@cindex command-line tools, as Guile modules +@cindex command modules +@item guix/scripts +This contains modules corresponding to @command{guix} sub-commands. For +example, the @code{(guix scripts shell)} module exports the +@code{guix-shell} procedure, which directly corresponds to the +@command{guix shell} command (@pxref{Invoking guix shell}). + +@cindex importer modules +@item guix/import +This contains supporting code for the importers and updaters +(@pxref{Invoking guix import}, and @pxref{Invoking guix refresh}). For +example, @code{(guix import pypi)} defines the interface to PyPI, which +is used by the @code{guix import pypi} command. +@end table + +The directories we have seen so far all live under @file{guix/}. The +other important place is the @code{gnu/} directory, which contains +primarily package definitions as well as libraries and tools for Guix +System (@pxref{System Configuration}) and Guix Home (@pxref{Home +Configuration}). + +@table @file +@cindex package modules +@item gnu/packages +This is by far the most crowded directory of the source tree: it +contains @dfn{package modules} that export package definitions +(@pxref{Package Modules}). A few examples: + +@table @code +@item (gnu packages base) +Module providing ``base'' packages: @code{glibc}, @code{coreutils}, +@code{grep}, etc. +@item (gnu packages guile) +Guile and core Guile packages. +@item (gnu packages linux) +The Linux-libre kernel and related packages. +@item (gnu packages python) +Python and core Python packages. +@item (gnu packages python-xyz) +Miscellaneous Python packages (we were not very creative). +@end table + +In any case, you can jump to a package definition using @command{guix +edit} (@pxref{Invoking guix edit}) and view its location with +@command{guix show} (@pxref{Invoking guix package}). + +@findex search-patches +@item gnu/packages/patches +This directory contains patches applied against packages and obtained +using the @code{search-patches} procedure. + +@item gnu/services +This contains service definitions, primarily for Guix System +(@pxref{Services}) but some of them are adapted and reused for Guix Home +as we will see below. Examples: + +@table @code +@item (gnu services) +The service framework itself, which defines the service and service type +data types (@pxref{Service Composition}). +@item (gnu services base) +``Base'' services (@pxref{Base Services}). +@item (gnu services desktop) +``Desktop'' services (@pxref{Desktop Services}). +@item (gnu services shepherd) +Support for Shepherd services (@pxref{Shepherd Services}). +@end table + +You can jump to a service definition using @command{guix system edit} +and view its location with @command{guix system search} (@pxref{Invoking +guix system}). + +@item gnu/system +These are core Guix System modules, such as: + +@table @code +@item (gnu system) +Defines @code{operating-system} (@pxref{operating-system Reference}). +@item (gnu system file-systems) +Defines @code{file-system} (@pxref{File Systems}). +@item (gnu system mapped-devices) +Defines @code{mapped-device} (@pxref{Mapped Devices}). +@end table + +@item gnu/build +These are modules that are either used on the ``build side'' when +building operating systems or packages, or at run time by operating +systems. + +@table @code +@item (gnu build accounts) +Creating @file{/etc/passwd}, @file{/etc/shadow}, etc. (@pxref{User +Accounts}). +@item (gnu build activation) +Activating an operating system at boot time or reconfiguration time. +@item (gnu build file-systems) +Searching, checking, and mounting file systems. +@item (gnu build linux-boot) +@itemx (gnu build hurd-boot) +Booting GNU/Linux and GNU/Hurd operating systems. +@item (gnu build linux-initrd) +Creating a Linux initial RAM disk (@pxref{Initial RAM Disk}). +@end table + +@item gnu/home +This contains all things Guix Home (@pxref{Home Configuration}); +examples: + +@table @code +@item (gnu home services) +Core services such as @code{home-files-service-type}. +@item (gnu home services ssh) +SSH-related services (@pxref{Secure Shell}). +@end table + +@item gnu/installer +This contains the text-mode graphical system installer (@pxref{Guided +Graphical Installation}). + +@item gnu/machine +These are the @dfn{machine abstractions} used by @command{guix deploy} +(@pxref{Invoking guix deploy}). + +@item gnu/tests +This contains system tests---tests that spawn virtual machines to check +that system services work as expected (@pxref{Running the Test Suite}). +@end table + +Last, there's also a few directories that contain files that are +@emph{not} Guile modules: + +@table @file +@item tests +These are unit tests, each file corresponding more or less to one +module, in particular @code{(guix @dots{})} modules (@pxref{Running the +Test Suite}). + +@item doc +This is the documentation in the form of Texinfo files: this manual and +the Cookbook. + +@item po +This is the location of translations of Guix itself, of package synopses +and descriptions, of the manual, and of the cookbook (@pxref{Translating +Guix}). + +@item etc +Miscellaneous files: shell completions, support for systemd and other +init systems, Git hooks, etc. +@end table + +With all this, a fair chunk of your operating system is at your +fingertips! Beyond @command{grep} and @command{git grep}, @pxref{The +Perfect Setup} on how to navigate code from your editor, and +@pxref{Using Guix Interactively} for information on how to use +interactively use Scheme modules. Enjoy! + @node Packaging Guidelines @section Packaging Guidelines diff --git a/doc/guix.texi b/doc/guix.texi index 87fe9f803c..fa26d78187 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7677,7 +7677,8 @@ Programming Interface that build results @emph{derive} from them. This chapter describes all these APIs in turn, starting from high-level -package definitions. +package definitions. @xref{Source Tree Structure}, for a more general +overview of the source code. @menu * Package Modules:: Packages from the programmer's viewpoint. base-commit: 9d9bb8955a939b89b5b28f1071b70ed9f9a54f8c -- 2.41.0