Kranzes/harmonia

Nix binary cache implemented in rust using libnix-store (maintained fork by @Mic92)

★ 0Forks 0RustGitHub ↗Compare

README

harmonia

Features

  • http-ranges support for nar file streaming
  • streaming build logs
  • .ls file streaming
    • Note: doesn't contain narOffset in json response but isn't needed for nix-index

Features added by this fork

  • Speedup serving of smaller nar files by generating nar files using nix as a library instead of starting a nix-store process for each nar file
  • Add /serve/<narhash>/ endpoint to allow serving the content of package. Also discovers index.html to allow serving websites directly from the nix store.

Build

Whole application

nix build -L

Get a development environment:

nix develop

Configuration

Configuration is done via a toml file. The location of the configuration file should be passed as env var CONFIG_FILE. If no config file is passed the following default values will be used:

bind = "[::]:5000"
workers = 4
max_connection_rate = 256
priority = 30

Per default we wont sign any narinfo because we don't have a secret key, to enable this feature enable it by providing a path to a private key generated by nix-store --generate-binary-cache-key cache.example.com-1 /etc/nix/cache.sk /etc/nix/cache.pk

sign_key_path = "/run/secrets/key"

harmonia will fallback to the SIGN_KEY_PATH environment if sign_key_path is not set in configuration.

Logging can be configured with env_logger. The default value is info,actix_web=debug. To only log errors use the following RUST_LOG=error and to only disable access logging, use RUST_LOG=info,actix_web::middleware=error

Run tests

nix flake check -L

Inspiration

Contributors

Conni2461dependabot[bot]Mic92bors[bot]cheriimoyadasJajs124r-vdpastroKranzesSuperSandro2000

Issues