CHICKEN is a Scheme compiler. It includes an interactive mode and a custom package format, “eggs”. CHICKEN 5 is R⁵RS-compliant, whereas CHICKEN 6 targets R⁷RS.
Package Sets
Each major release of CHICKEN has its own package set, because eggs are compiled against a specific binary version of the compiler and cannot be shared between releases:
chickenPackages_5— CHICKEN 5, and the set the unversioned attributes (chicken,chickenPackages,eggDerivation,fetchegg) point at.chickenPackages_6— CHICKEN 6.chickenPackages_4— CHICKEN 4; kept for the few packages that still need it and maintained on a best-effort basis.
Each set provides chicken, eggDerivation, fetchegg and an chickenEggs
attrset of eggs published for that release. Note that upstream has not ported
every egg to CHICKEN 6 yet, so chickenPackages_6.chickenEggs is considerably
smaller than its CHICKEN 5 counterpart.
CHICKEN 5 and 6 are built from the same expressions, in
pkgs/development/compilers/chicken/common/; the release directories next to
it hold only what differs between releases, which is the compiler’s version and
its egg set. CHICKEN 4 predates that arrangement and stands on its own.
Using Eggs
Eggs described in Nixpkgs are available inside the
chickenPackages.chickenEggs attrset. Including an egg as a build input is
done in the typical Nix fashion. For example, to include support for SRFI
189 in a derivation, one
might write:
{ buildInputs = [ chicken chickenPackages.chickenEggs.srfi-189 ];}Both chicken and its eggs have a setup hook which configures the environment
variables CHICKEN_INCLUDE_PATH and CHICKEN_REPOSITORY_PATH.
Updating Eggs
For CHICKEN 5 and 6, the egg set is generated from upstream’s list of latest
egg releases, so there is no list of eggs to curate in Nixpkgs: every egg
published for that release is included. The generated metadata lives in the
release directory’s deps.toml, and is regenerated by running the shared
update.sh script with the release to update:
$ cd pkgs/development/compilers/chicken/common/$ ./update.sh 6This clones upstream’s eggs-<major>-latest repository, prefetches each egg
tarball and converts the egg metadata into deps.toml. Do not edit
deps.toml by hand.
Eggs that need extra native dependencies or other fixups are patched up in
overrides.nix in the release directory; the entries there are keyed by egg
name and applied automatically by eggDerivation.
Adding Eggs
CHICKEN 4 predates the workflow above: its much smaller set is generated with
egg2nix from a hand-written list of
eggs, so eggs have to be added explicitly. The list is
pkgs/development/compilers/chicken/4/eggs.scm; the first section lists eggs
which are required by egg2nix itself, all other eggs go into the second
section. After editing, regenerate the set:
$ nix-shell -p chickenPackages_4.egg2nix$ cd pkgs/development/compilers/chicken/4/$ egg2nix eggs.scm > eggs.nixegg2nix resolves one collection of eggs with mutually-compatible versions, so
adding an egg may update existing ones. To keep those changes separate,
regenerate the set before adding more eggs.
Override Scope
The chicken package and its eggs, respectively, reside in a scope. This means, the scope can be overridden to affect other packages in it.
This example shows how to use a local copy of srfi-180 and have it affect
all the other eggs:
let myChickenPackages = pkgs.chickenPackages.overrideScope ( self: super: { # The chicken package itself can be overridden to affect the whole ecosystem. # chicken = super.chicken.overrideAttrs { # src = ... # };
chickenEggs = super.chickenEggs.overrideScope ( eggself: eggsuper: { srfi-180 = eggsuper.srfi-180.overrideAttrs { # path to a local copy of srfi-180 src = <...>; }; } ); } ); # Here, `myChickenPackages.chickenEggs.json-rpc`, which depends on `srfi-180` will use # the local copy of `srfi-180`.in<...>