[Nix-dev] How to use the binary cache at hydra.cryp.to for Haskell binaries

Peter Simons simons at cryp.to
Fri Aug 28 22:21:30 CEST 2015


Fellow Nix'ers,

the binary cache at hydra.cryp.to has been popular with Haskell users
because it tends to have x86_64-linux binaries for "haskellPackages"
sooner than hydra.nixos.org or cache.nixos.org do. Now, users who follow
the "nixos-unstable" channel or any of the "nixos-xx.yy" release
channels don't need to configure access hydra.cryp.to! Using that site
makes sense only if you're building things directly from the current
head of the "master" branch of the Git repository. If you're one of
those, then you can configure access as follows.

In NixOS, add the following snippet to your configuration.nix file:

 | nix = {
 |   trustedBinaryCaches = [ http://hydra.cryp.to ];
 |   binaryCachePublicKeys = [
 |     "hydra.cryp.to-1:8g6Hxvnp/O//5Q1bjjMTd5RO8ztTsG8DKPOAg9ANr2g="
 |   ];
 | };

Users of Nix on other host systems, need to edit their /etc/nix/nix.conf
file:

 | trusted-binary-caches = http://hydra.cryp.to
 | binary-cache-public-keys = hydra.cryp.to-1:8g6Hxvnp/O//5Q1bjjMTd5RO8ztTsG8DKPOAg9ANr2g=

Note that the "binary-cache-public-keys" file will usually contain an
entry for cache.nixos.org already, so you want to *add* that key to the
one you already have.

Restart your "nix-daemon" and then use the command-line flags "--option
extra-binary-caches http://hydra.cryp.to" every time you run
"nix-build", "nix-shell", or "nix-env" to compile Haskell packages. If
at all possible, please avoid querying the cache more often than
necessary because the machine is not particularly quick.

Alternatively, set up a cron job that pulls the binary manifest from the
server every now and then, i.e. via configuration.nix:

 | services.cron.systemCronJobs = [
 |   "49 */3 * * * root nix-pull &>/dev/null http://hydra.cryp.to/jobset/nixpkgs/haskell-updates/channel/latest/MANIFEST"
 | ];

Then your machine will "just know" which binary packages exist on the
server even if you don't provide the extra command-line flags.

I hope this helps,
Peter



More information about the nix-dev mailing list