Harmonia: Difference between revisions
Appearance
Initial page |
Switched to harmonia |
||
| Line 1: | Line 1: | ||
[https://github.com | [https://github.com/nix-community/harmonia harmonia] 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 === | === Setup === | ||
First generate required public and private store keys.<syntaxhighlight lang="bash"> | First generate required public and private store keys.<syntaxhighlight lang="bash"> | ||
mkdir -p /var/lib/ | mkdir -p /var/lib/harmonia | ||
nix-store --generate-binary-cache-key cache. | nix-store --generate-binary-cache-key cache.example.org-1 \ | ||
/var/lib/ | /var/lib/harmonia/cache-priv-key.pem \ | ||
/var/lib/ | /var/lib/harmonia/cache-pub-key.pem | ||
chown | chown harmonia:harmonia /var/lib/harmonia/cache-priv-key.pem | ||
chmod 600 /var/lib/ | chmod 600 /var/lib/harmonia/cache-priv-key.pem | ||
chmod 644 /var/lib/ | chmod 644 /var/lib/harmonia/cache-pub-key.pem | ||
</syntaxhighlight>Add following snippet to your system configuration and apply it.<syntaxhighlight lang="nix"> | </syntaxhighlight>Add following snippet to your system configuration and apply it.<syntaxhighlight lang="nix"> | ||
services. | services.harmonia = { | ||
enable = true; | enable = true; | ||
secretKeyFile = "/var/lib/ | secretKeyFile = "/var/lib/harmonia/cache-priv-key.pem"; | ||
}; | }; | ||
</syntaxhighlight>The cache will be served on http://127.0.0.1:5000. | </syntaxhighlight>The cache will be served on http://127.0.0.1:5000. | ||
<syntaxhighlight lang="nix"> | |||
services.caddy = { | |||
enable = true; | |||
openFirewall = true; | |||
virtualHosts."cache.example.org".extraConfig = '' | |||
reverse_proxy 127.0.0.1:5000 | |||
''; | |||
}; | |||
</syntaxhighlight> | |||
Revision as of 12:05, 20 October 2026
harmonia 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/harmonia
nix-store --generate-binary-cache-key cache.example.org-1 \
/var/lib/harmonia/cache-priv-key.pem \
/var/lib/harmonia/cache-pub-key.pem
chown harmonia:harmonia /var/lib/harmonia/cache-priv-key.pem
chmod 600 /var/lib/harmonia/cache-priv-key.pem
chmod 644 /var/lib/harmonia/cache-pub-key.pem
Add following snippet to your system configuration and apply it.
services.harmonia = {
enable = true;
secretKeyFile = "/var/lib/harmonia/cache-priv-key.pem";
};
The cache will be served on http://127.0.0.1:5000.
services.caddy = {
enable = true;
openFirewall = true;
virtualHosts."cache.example.org".extraConfig = ''
reverse_proxy 127.0.0.1:5000
'';
};