~evhan/beaker

ref: 49dd5955acf9287ec5ba0503e8c30e6e81b3e746 beaker/nix.md -rw-r--r-- 1.8 KiB
49dd5955Evan Hanson Document Nix helpers 8 months ago

=== Usage

This library's Nix helpers can be imported from the Git repository archive:

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

The project's default.nix only includes two helpers 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 {
    overrideFile = ./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 overrideFile, 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"
  overrideFile = ./eggs.lock
  hash = "sha256:03pz5927dkazrf8hf53w03r80ca98fwp09gmd8iiywxc5vl8ll2m"
}

=== 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.