- KoboldCpp is available on Nixpkgs and can be installed by adding just
koboldcpp
to yourenvironment.systemPackages
(or it can also be placed inhome.packages
).
In order to enable NVIDIA CUDA support, you'll need to configure several settings:
- Enable required options:
nixpkgs.config.allowUnfree = true; # Allow proprietary software
nixpkgs.config.cudaSupport = true; # Enable CUDA functionality
- Enable graphics support based on your NixOS version:
# For NixOS 24.05:
hardware.opengl.enable = true;
# For NixOS 24.11 or unstable:
hardware.graphics.enable = true;
- Set your GPU architecture:
nixpkgs.config.cudaArches = [ "sm_75" ]; # Example for RTX 2080
To find your GPU's architecture code:
- Visit the NVIDIA Architecture Guide
- Locate your GPU Architecture
- Use the corresponding
sm_XX
code in your configuration
- ✅ Vulkan: Enabled by default on Linux and macOS
- ✅ Metal: Enabled by default on macOS
- ❌ ROCm: Not currently available
nixpkgs.config = {
allowUnfree = true;
cudaSupport = true;
cudaArches = [ "sm_75" ];
};
# NixOS 24.05
hardware.opengl.enable = true;
# NixOS 24.11 or unstable
# hardware.graphics.enable = true;
environment.systemPackages = [ pkgs.koboldcpp ];
# If you're using home-manager to install KoboldCpp
# home.packages = [ pkgs.koboldcpp ];
The setup for Home Manager is the same as regular Nix, with one exception regarding Home Manager's instance of nixpkgs. By default, Home Manager manages its own isolated instance of nixpkgs, which has two implications:
- You can keep your private Home Manager nixpkgs instance and simply repeat your
nixpkgs.config
in home manager. - You can set
home-manager.useGlobalPkgs = true;
to copy your module system's nixpkgs instance. This way, you only need to define it in yourconfiguration.nix
, and Home Manager will "inherit" this configuration.
- If you face any issues with running KoboldCpp on Nix, please open an issue here