Skip to content

Latest commit

 

History

History
150 lines (100 loc) · 6.04 KB

README.org

File metadata and controls

150 lines (100 loc) · 6.04 KB

Tarides Guix Channel

Guix channel containing packages used for development at Tarides.

Overview

This repository contains Guix package defintions. A package definition defines the inputs required to build some package as well as the exact steps to build the package. Inputs include libraries used by the package (e.g. OCaml libraries) but also the OCaml compiler itself as well as any C libraries. Inputs themselves are also packages that are defined using package definitions. This allows us to pin the entire graph of transitive dependencies required to build some package (e.g. this includes the C compiler used to compile the OCaml compiler). Most packages are defined by the Guix project. The root is formed by a binary bootstrap seed.

These exact definitions of packages allow dependable and reproducible builds and build environments. Guix has been used to keep old code (and the build environment for it) running [1] and is used by projects to provide bootstrappable builds [2].

Package definitions in this repository are specific to development for Tarides. Things that are useful more generally should be upstreamed to Guix (see the section on contributing in the Guix manual).

For more information see also the Guix Reference Manual (also available in French).

Setup

Installing Guix

Guix is currently only available for GNU/Linux systems (and GNU/Hurd).

For Debian stable a package is available and Guix can be installed with apt install guix.

For Arch Linux see this wiki entry.

For other systems use the binary installation.

Adding the channel

Add the channel to your .config/guix/channels.scm:

(cons
 (channel
  (name 'tarides)
  (url "https://github.com/adatario/guix-tarides.git")
  (branch "main"))
 %default-channels)

See also Specifying Additional Channels in the Guix Reference Manual.

Before being able to use the channel you need to pull it in by running `guix pull` (see also next section).

Updating the channel

If updates are pushed to the channel you need to fetch these updates by running:

guix pull

Usage

Creating an environment with some package

Following command will create a shell (development environment) that has the OCaml packages Irmin and Alcotest installed:

guix shell ocaml-irmin ocaml-alcotest

Note: make sure that OPAM does not overwrite the shell environment (this can happen if you run `eval $(opam env)` in your `.bashrc`). Run `guix shell –check` to check that this does not happen.

Building a package with a specific Irmin

To build a package with Irmin 3.5:

(use-modules
 (tarides packages irmin)
 (tarides packages tezos))

(package-with-irmin-3.5 ocaml-tezos-context)

or with 3.4:

(use-modules
 (tarides packages irmin)
 (tarides packages tezos))

(package-with-irmin-3.4 ocaml-tezos-context)

Build Irmin with OCaml 5

Easy peasy:

(use-modules
 (guix build-system ocaml)
 (tarides packages irmin))

(package-with-ocaml-mtime-1.4
 (package-with-ocaml5.0 ocaml-irmin))

Building a package using a version of Irmin from a specific Git branch

(use-modules
 (guix packages)
 (guix git)
 (guix git-download)
 (tarides packages irmin)
 (tarides packages tezos))

;; Define the Git URL, version and commit of Irmin to use

(define irmin-url "https://github.com/metanivek/irmin")
(define irmin-version "3.5.1-disallow-split") ; this is only used for human readability
(define irmin-commit "662f57f6b02cccbd6d782178f9c579b9c32bbdfb")
(define irmin-sha256 "16knbciyfp28gc8hn4mim4qymdvahb12z9blr5ilfl2h6ail28yn")

;; Use the `package-with-irmin-3.5` transformation that allows the
;; explicit origin of the Irmin source to be specified.

(package-with-irmin-3.5
 ocaml-tezos-context-replay
 #:origin (origin
	     (method git-fetch)
	     (uri (git-reference
		   (url irmin-url)
		   (commit irmin-commit)))
	     (sha256 (base32 irmin-sha256)))
 #:version irmin-version)

There is also a package-with-irmin-3.4 transformation The differentiation is useful even when the exact origin of the Irmin source code is specified, as different versions of Irmin might require a different set of dependencies (e.g. ocam-my-cool-library might be needed for Irmin 3.5 but not Irmin 3.4). Using the appropriate transformation makes sure the correct set of dependencies are provided. For finer control of dependencies we can use custom package transformations, see for example how package-with-irmin-3.* is defined in ./tarides/packages/irmin.scm.

If stored in a file custom-ocaml-tezos-context-replay.scm (in Emacs try org-babel-tangle) it can be built with:

guix build -f custom-ocaml-tezos-context-replay.scm

The replay executables can then be run:

/gnu/store/yxk29w6x43rwh8igizg12k0knpziqy8b-ocaml-tezos-context-replay-git-0.7cda5ed/bin/tezos-context-replay --help

License

GPL-3.0-or-later (same as Guix).