1# CHICKEN {#sec-chicken} 2 3[CHICKEN](https://call-cc.org/) is a 4[R⁵RS](https://schemers.org/Documents/Standards/R5RS/HTML/)-compliant Scheme 5compiler. It includes an interactive mode and a custom package format, "eggs". 6 7## Using Eggs {#sec-chicken-using} 8 9Eggs described in nixpkgs are available inside the 10`chickenPackages.chickenEggs` attrset. Including an egg as a build input is 11done in the typical Nix fashion. For example, to include support for [SRFI 12189](https://srfi.schemers.org/srfi-189/srfi-189.html) in a derivation, one 13might write: 14 15```nix 16{ 17 buildInputs = [ 18 chicken 19 chickenPackages.chickenEggs.srfi-189 20 ]; 21} 22``` 23 24Both `chicken` and its eggs have a setup hook which configures the environment 25variables `CHICKEN_INCLUDE_PATH` and `CHICKEN_REPOSITORY_PATH`. 26 27## Updating Eggs {#sec-chicken-updating-eggs} 28 29nixpkgs only knows about a subset of all published eggs. It uses 30[egg2nix](https://github.com/the-kenny/egg2nix) to generate a 31package set from a list of eggs to include. 32 33The package set is regenerated by running the following shell commands: 34 35``` 36$ nix-shell -p chickenPackages.egg2nix 37$ cd pkgs/development/compilers/chicken/5/ 38$ egg2nix eggs.scm > eggs.nix 39``` 40 41## Adding Eggs {#sec-chicken-adding-eggs} 42 43When we run `egg2nix`, we obtain one collection of eggs with 44mutually-compatible versions. This means that when we add new eggs, we may 45need to update existing eggs. To keep those separate, follow the procedure for 46updating eggs before including more eggs. 47 48To include more eggs, edit `pkgs/development/compilers/chicken/5/eggs.scm`. 49The first section of this file lists eggs which are required by `egg2nix` 50itself; all other eggs go into the second section. After editing, follow the 51procedure for updating eggs. 52 53## Override Scope {#sec-chicken-override-scope} 54 55The chicken package and its eggs, respectively, reside in a scope. This means, 56the scope can be overridden to affect other packages in it. 57 58This example shows how to use a local copy of `srfi-180` and have it affect 59all the other eggs: 60 61```nix 62let 63 myChickenPackages = pkgs.chickenPackages.overrideScope ( 64 self: super: { 65 # The chicken package itself can be overridden to affect the whole ecosystem. 66 # chicken = super.chicken.overrideAttrs { 67 # src = ... 68 # }; 69 70 chickenEggs = super.chickenEggs.overrideScope ( 71 eggself: eggsuper: { 72 srfi-180 = eggsuper.srfi-180.overrideAttrs { 73 # path to a local copy of srfi-180 74 src = <...>; 75 }; 76 } 77 ); 78 } 79 ); 80 # Here, `myChickenPackages.chickenEggs.json-rpc`, which depends on `srfi-180` will use 81 # the local copy of `srfi-180`. 82in 83<...> 84```