Changeset 39517 in project


Ignore:
Timestamp:
01/18/21 22:23:47 (5 months ago)
Author:
evhan
Message:

wiki/beaker: Document Nix helpers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/beaker

    r39510 r39517  
    196196as necessary.
    197197
     198== Nix Helpers
     199
     200=== Usage
     201
     202This library's Nix helpers can be imported from the Git repository archive:
     203
     204 let
     205   beaker = import (fetchTarball https://git.sr.ht/~evhan/beaker/archive/master.tar.gz) {};
     206 in
     207   doStuff { ... }
     208
     209The project's {{default.nix}} only includes two helpers so it's also relatively
     210harmless to pull into scope, for example:
     211
     212 with import (fetchTarball https://git.sr.ht/~evhan/beaker/archive/6bfb584b.tar.gz) {};
     213 
     214 eggProgram {
     215   name = "example";
     216   src = ./.;
     217   eggCache = eggCache {
     218     overrideFile = ./example.egg.lock;
     219     hash = "sha256:00x5k7rhs1fy7fj5kma1yp2ikzbq98bfm33si5y8z8m25chb45sg";
     220   };
     221 }
     222
     223=== Fetching Egg Dependencies
     224
     225<procedure>eggCache attrSet</procedure>
     226
     227A fixed-output derivation that fetches a set of eggs for installation.
     228
     229The list of eggs to cache should be specified via {{overrideFile}}, which
     230expects a path to a file in "override" specifying a list of egg names and
     231versions. This file can be generated via {{chicken-status -list}} (for installed
     232eggs) or {{chicken-lock}} (for a specific egg's dependencies).
     233
     234 eggCache {
     235   name = "example-egg-cache"
     236   overrideFile = ./eggs.lock
     237   hash = "sha256:03pz5927dkazrf8hf53w03r80ca98fwp09gmd8iiywxc5vl8ll2m"
     238 }
     239
     240=== Building Eggs
     241
     242<procedure>eggProgram attrSet</procedure>
     243
     244Builds any eggs in the given {{src}} directory, bundling all dependencies and
     245placing the resulting binaries into {{<path>/bin}}.
     246
     247Egg dependencies must be provided via {{eggCache}} so that all inputs are known
     248at build time. If any dependencies are missing from the cache, the build will
     249fail with the error message {{"extension or version not found: <egg>"}}.
     250
     251 eggProgram {
     252   name = "example-program";
     253   src = ./.;
     254   eggCache = eggCache { ... };
     255 }
     256
     257Apart from {{eggCache}}, this derivation accepts all the same attributes as
     258{{stdenv.mkDerivation}}.
     259
    198260== Links
    199261
Note: See TracChangeset for help on using the changeset viewer.