Documentation

menu
ModulesNodejsHaskellRustPostgreSQLUserHostingIntroductionBranch HostingPull-request DeploymentsSecretsPersistenceDebuggingMultiple ServersCustom DomainsExample: Typescript & GoExample: JitsiExample: RSS BridgeExample: Tiny Tiny RSSExample: SearxActionsInstalling Nixyaml configNix FlakesWhat Garnix CI doesIncremental BuildsUsing Private InputsCachingGitHub Actions IntegrationBadgesGarnopen source

Cachingshare

One of the wonders of nix is the power of binary caches. With binary caches, you can share binaries (and other build outputs) easily, so you never have to build software twice for the same architecture. Once you have the cache set up, nix handles the rest, so that when you build with nix, if a known cache has what you need, it's simply downloaded rather than built from scratch.

In order to use the cache that garnix provides, change your nix.conf, adding https://cache.garnix.io to substituters, and cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= to trusted-public-keys.

Private Cachesshare

Any derivations that have been built only by private repos require authentication to download from cache.garnix.io. With this authentication, anyone with read access to the repository on GitHub will be able to download the derivation.

To access a private cache with your local nix installation, you must create an access token on your account page. Then you have to create a netrc file, for example in /etc/nix/netrc, containing your access token:

machine cache.garnix.io
  login ${YOUR_GITHUB_USER}
  password ${YOUR_GARNIX_ACCESS_TOKEN}

And you have to add this to your /etc/nix/nix.conf:

netrc-file = /etc/nix/netrc
narinfo-cache-positive-ttl = 3600

The narinfo-cache-positive-ttl setting by default is very high (30 days). It has to be lowered, since garnix uses presigned urls for private store paths that expire much quicker. It should be set to 3600 (i.e. 1 hour).