all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: help-guix@gnu.org, Rodrigo Morales <moralesrodrigo1100@gmail.com>
Subject: Re: Newbie: What's the importance of *.drv, *.-builder, etc. files in /gnu/store?
Date: Sat, 08 Apr 2023 09:35:10 +0200	[thread overview]
Message-ID: <E2C6B435-C802-483F-97B3-8D08D455C8D6@lepiller.eu> (raw)
In-Reply-To: <CAGxMbPbpV3_7+n6oVrN40aRnOqQjsG5yJyyiA1ujYpUz6YCYtA@mail.gmail.com>

Going step by step, Guix performs the following.

First, it needs to download the original sources of the package. When creating a store item, most of the time, the guix daemon is involved.

The daemon's purpose is to take a lower-level representation of a build procedure and turn that into an isolated build environment. This is called a *derivation* and it is stored in the store as a `drv` file. For downloading a file, the derivation simply contains the URL to download and the daemon performs the download itself, so no isolated environment is required here.

Then, the package contains a directive that informs Guix there is some sort of change to make in the source. There is an issue in the upstream sources, and we need to apply a patch. A `.patch` file is a standard file used in many projects to represent one or more changes to a file or a directory. It's not specific to Guix.

To apply the file, the daemon needs to create an isolated build environment where it can apply the patch. Although a derivation can specify how to make a build environment (it specifies inputs (dependencies), the type of system, expected output, etc), it does not say *what* to do with it.

The guix daemon does not run inside the isolated build environment (the "build-side"), but it needs to run something in it to get things done, somehow. This is the role of the builder, which is created by Guix and is derived from the package definition. It's a standalone Guile script that is executed on the build-side.

On the build-side, the builder extracts the original archive, applies the patch and archives the result as a new `.tar.xz` file.

Now, Guix is ready to build transmission. To do so, it creates a new derivation `.drv` that instructs the daemon how to make the isolated environment for building it, and a builder `-builder` that the daemon will execute inside the environment. The build results in the transmission outputs.

To summarize, Guix needs to:

- Download original sources, which creates a derivation (drv) and results in downloading a tar.xz to the store.
- Put a patch (.patch) in the store from its own sources, which doesn't create a derivation. This is because a derivation can only refer to another store item.
- Apply the patch to the sources, which creates a derivation (.drv) and a builder (tar.xz-builder) that result in creating a modified tar.xz in the store.
- Build the transmission package, which creates a derivation (drv) and a builder (-builder) that result in the transmission outputs you wanted in the first place.

HTH!


  reply	other threads:[~2023-04-08  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08  0:49 Newbie: What's the importance of *.drv, *.-builder, etc. files in /gnu/store? Rodrigo Morales
2023-04-08  7:35 ` Julien Lepiller [this message]
2023-04-08 15:06 ` (

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E2C6B435-C802-483F-97B3-8D08D455C8D6@lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=help-guix@gnu.org \
    --cc=moralesrodrigo1100@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.