/harmonia

Nix binary cache implemented in rust using libnix-store

Primary LanguageRustMIT LicenseMIT

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

Build

Whole application

nix-shell --run cargo b

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 = "127.0.0.1:8080"
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"

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-build -E 'with import <nixpkgs> {}; callPackage ./test.nix {nixpkgs = pkgs;}'

Inspiration