ref: 3679375a8efe39d4cecd26d5ea483dc00927c84a beaker/nix.md -rw-r--r-- 2.1 KiB
3679375aEvan Hanson Extend `eggCache` to allow specifying eggs directly 8 months ago

=== Usage

The helpers can be imported from the Git repository archive:

  beaker = import (fetchTarball https://git.sr.ht/~evhan/beaker/archive/master.tar.gz) {};
  doStuff { ... }

This library only includes two attributes, so it's also relatively harmless to pull into scope, for example:

with import (fetchTarball https://git.sr.ht/~evhan/beaker/archive/6bfb584b.tar.gz) {};

eggProgram {
  name = "example";
  src = ./.;
  eggCache = eggCache {
    eggs = ./example.egg.lock;
    hash = "sha256:00x5k7rhs1fy7fj5kma1yp2ikzbq98bfm33si5y8z8m25chb45sg";

=== Fetching Egg Dependencies

[procedure] eggCache attrSet

A fixed-output derivation that fetches a set of eggs for installation.

The list of eggs to cache should be specified via eggs, which expects a path to a file in "override" specifying a list of egg names and versions. This file can be generated via chicken-status -list (for installed eggs) or chicken-lock (for a specific egg's dependencies).

eggCache {
  name = "example-egg-cache"
  hash = "sha256:03pz5927dkazrf8hf53w03r80ca98fwp09gmd8iiywxc5vl8ll2m"
  eggs = ./eggs.lock

Alternatively, you can specify the list of eggs directly:

eggCache {
  name = "example-egg-cache"
  hash = "sha256:1yrlmk6d9y71x6rirp9imrkkc1y4ph7042xchrb07dsfl6svxc6k"
  eggs = [
    { name = "srfi-18"; version = "0.1"; };
    { name = "srfi-69"; version = "0.4"; };

=== Building Eggs

[procedure] eggProgram attrSet

Builds any eggs in the given src directory, bundling all dependencies and placing the resulting binaries into <path>/bin.

Egg dependencies must be provided via eggCache so that all inputs are known at build time. If any dependencies are missing from the cache, the build will fail with the error message "extension or version not found: <egg>".

eggProgram {
  name = "example-program";
  src = ./.;
  eggCache = eggCache { ... };

Apart from eggCache, this derivation accepts all the same attributes as stdenv.mkDerivation.