Jump to content

Harmonia: Difference between revisions

From Official NixOS Wiki
Onny (talk | contribs)
Initial page
(No difference)

Revision as of 11:36, 20 October 2026

nix-serve is a small utility to serve a Nix store as a binary cache, allowing it to be used as a substituter by other Nix installations.

Setup

First generate required public and private store keys.

mkdir -p /var/lib/nix-serve
nix-store --generate-binary-cache-key cache.project-insanity.org-1 \
  /var/lib/nix-serve/cache-priv-key.pem \
  /var/lib/nix-serve/cache-pub-key.pem

chown nix-serve:nix-serve /var/lib/nix-serve/cache-priv-key.pem
chmod 600 /var/lib/nix-serve/cache-priv-key.pem
chmod 644 /var/lib/nix-serve/cache-pub-key.pem

Add following snippet to your system configuration and apply it.

services.nix-serve = {
  enable = true;
  secretKeyFile = "/var/lib/nix-serve/cache-priv-key.pem";
};

The cache will be served on http://127.0.0.1:5000.