- The Nix package manager must be installed.
- Flakes must be enabled in your Nix configuration.
The flake.nix provides multiple platform and hardware-specific builds.
The following backends are available:
vulkan: Hardware-accelerated build using Vulkan. (Default on Linux)cuda: Hardware-accelerated build using NVIDIA CUDA.metal: Hardware-accelerated build using Apple Metal. (Default on macOS)cpu: Portable CPU-only build.
All packages include the main tools: audiocpp_cli, audiocpp_server, audiocpp_gguf, and the Python-based audiocpp_model_manager.
Build the default package for your operating system:
nix build .Build explicitly for a desired backend:
nix build .#vulkan
nix build .#cuda
nix build .#metal
nix build .#cpuAfter building, the compiled binaries will be available in the result/bin/ directory.
You can execute the CLI directly via nix run (which uses audiocpp_cli as the main program):
nix run .#vulkan -- <arguments...>To run the server, use nix shell or execute from the build result:
nix shell .#vulkan -c audiocpp_server <arguments...>
# or
./result/bin/audiocpp_server <arguments...>The flake seamlessly bundles the model_manager.py Python script along with all its required dependencies (PyTorch, Safetensors, etc.) as audiocpp_model_manager.
nix shell .#vulkan -c audiocpp_model_manager install supertonic_3If you want to work on audio.cpp and need a development environment with cmake, ninja, and all the necessary C++ and Python dependencies pre-configured, simply run:
nix developYou can easily include audio.cpp as a flake input in your own NixOS configuration or other Nix projects.
In your flake.nix, add it to your inputs, making sure to use follows to avoid duplicating nixpkgs versions:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
audiocpp.url = "github:0xShug0/audio.cpp";
audiocpp.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, audiocpp, ... }: {
nixosConfigurations.my-machine = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }: {
environment.systemPackages = [
# Add the default package (auto-detects Metal/Vulkan based on OS)
audiocpp.packages.x86_64-linux.default
# Or explicitly select a backend flavor:
# audiocpp.packages.x86_64-linux.vulkan
# audiocpp.packages.x86_64-linux.cuda
];
})
];
};
};
}