Next: , Previous: , Up: Contributing   [Contents][Index]


22.2 Building from Git

If you want to hack Guix itself, it is recommended to use the latest version from the Git repository:

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

How do you ensure that you obtained a genuine copy of the repository? To do that, run guix git authenticate, passing it the commit and OpenPGP fingerprint of the channel introduction (see Invoking guix git authenticate):

git fetch origin keyring:keyring
guix git authenticate 9edb3f66fd807b096b48283debdcddccfea34bad \
  "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA"

This command completes with exit code zero on success; it prints an error message and exits with a non-zero code otherwise.

As you can see, there is a chicken-and-egg problem: you first need to have Guix installed. Typically you would install Guix System (see System Installation) or Guix on top of another distro (see Binary Installation); in either case, you would verify the OpenPGP signature on the installation medium. This “bootstraps” the trust chain.

The easiest way to set up a development environment for Guix is, of course, by using Guix! The following command starts a new shell where all the dependencies and appropriate environment variables are set up to hack on Guix:

guix shell -D guix -CPW

or even, from within a Git worktree for Guix:

guix shell -CPW

If -C (short for --container) is not supported on your system, try --pure instead of -CPW. See Invoking guix shell, for more information on that command.

If you are unable to use Guix when building Guix from a checkout, the following are the required packages in addition to those mentioned in the installation instructions (see Requirements).

On Guix, extra dependencies can be added by instead running guix shell:

guix shell -D guix help2man git strace --pure

From there you can generate the build system infrastructure using Autoconf and Automake:

./bootstrap

If you get an error like this one:

configure.ac:46: error: possibly undefined macro: PKG_CHECK_MODULES

it probably means that Autoconf couldn’t find pkg.m4, which is provided by pkg-config. Make sure that pkg.m4 is available. The same holds for the guile.m4 set of macros provided by Guile. For instance, if you installed Automake in /usr/local, it wouldn’t look for .m4 files in /usr/share. In that case, you have to invoke the following command:

export ACLOCAL_PATH=/usr/share/aclocal

See Macro Search Path in The GNU Automake Manual, for more information.

Then, run:

./configure

Optionally, --localstatedir and --sysconfdir can also be provided as arguments. By default, localstatedir is /var (see The Store, for information about this) and sysconfdir is /etc. Note that you will probably not run make install at the end (you don’t have to) but it’s still important to pass the right localstatedir and sysconfdir values, which get recorded in the (guix config) Guile module.

Finally, you can build Guix and, if you feel so inclined, run the tests (see Running the Test Suite):

make
make check

If anything fails, take a look at installation instructions (see Installation) or send a message to the mailing list.

From there on, you can authenticate all the commits included in your checkout by running:

guix git authenticate \
  9edb3f66fd807b096b48283debdcddccfea34bad \
  "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA"

The first run takes a couple of minutes, but subsequent runs are faster. On subsequent runs, you can run the command without any arguments since the introduction (the commit ID and OpenPGP fingerprints above) will have been recorded44:

guix git authenticate

When your configuration for your local Git repository doesn’t match the default one, you can provide the reference for the keyring branch via the -k option. The following example assumes that you have a Git remote called ‘myremote’ pointing to the official repository:

guix git authenticate \
  -k myremote/keyring \
  9edb3f66fd807b096b48283debdcddccfea34bad \
  "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA"

See Invoking guix git authenticate, for more information on this command.

Note: By default, hooks are installed such that guix git authenticate is invoked anytime you run git pull or git push.

After updating the repository, make might fail with an error similar to the following example:

error: failed to load 'gnu/packages/linux.scm':
ice-9/eval.scm:293:34: In procedure abi-check: #<record-type <origin>>: record ABI mismatch; recompilation needed

This means that one of the record types that Guix defines (in this example, the origin record) has changed, and all of guix needs to be recompiled to take that change into account. To do so, run make clean-go followed by make.

Should make fail with an Automake error message after updating, you need to repeat the steps outlined in this section, commencing with ./bootstrap.


Footnotes

(44)

This requires a recent version of Guix, from May 2024 or more recent.


Next: Running the Test Suite, Previous: Requirements, Up: Contributing   [Contents][Index]