Llama.cpp: lack of configuration tutorial videos

I’ve wanted to use llama-cpp but the biggest barrier I have right now is figuring out how to configure it into my configuration.nix file.

I’ve seen millions of tutorials on how to configure ollama and it’s very easy to setup. Even the NixOS wiki is pretty straight forward and easy.
I’m currently still use ollama, but I still want to shift to llama-cpp.

I feel like we’re lacking a tutorial or video on how to configure llama-cpp, and I think if there were more, it’d probably get more people to use it.

Something that bugs me is configuring the models:

{
  services.llama-cpp = {
    enable = true;
    package = pkgs.llama-cpp-vulkan;
    # package = (pkgs.llama-cpp.override { cudaSupport = true; })
    # package = pkgs.llama-cpp-rocm;

    # Takes care of downloading if model not present
    modelsPreset = {
      # Requires 8GB VRAM 
      "LFM2.5-8B-A1B" = {
        hf-repo = "unsloth/LFM2.5-8B-A1B-GGUF";
        hf-file = "LFM2.5-8B-A1B-UD-Q4_K_XL.gguf";
        alias = "unsloth/LFM2.5-8B-A1B-GGUF";
        temp = "0.2";
        repeat-penalty = "1.05";
        top-k = "80";
      };
      # Requires 56GB VRAM 
      "Qwen3-Coder-Next" = {
        hf-repo = "unsloth/Qwen3-Coder-Next-GGUF";
        hf-file = "Qwen3-Coder-Next-UD-Q4_K_XL.gguf";
        alias = "unsloth/Qwen3-Coder-Next";
        temp = "1.0";
        top-p = "0.95";
        top-k = "40";
      };
    };
  };
}

Where do people find the Hugging Face details for hf-repo , hf-file, and alias?

For example, I’m trying to find that information for this specific model: DavidAU/Qwen3.5-9B-The-Defiant-Fable-Uncensored-Heretic-NEO-IMATRIX-MAX-MTP-GGUF · Hugging Face

reference: Llama-cpp - Official NixOS Wiki

hf-repo there is likely referring to the Hugging Face repo, which would be DavidAU/Qwen3.5-9B-The-Defiant-Fable-Uncensored-Heretic-NEO-IMATRIX-MAX-MTP-GGUF.

hf-file is the particular quant you want to use, for example Qwen3.5-9B-The-Defiant-Fable-Uncnr-Heretic-NEO-MAX-MTP-Q6_K.gguf.

alias is from the llama-cpp docs: some handy way of referring to the model.

The documentation for the service config options (indeed, the definitions themselves–currently a nested attrset as described) could almost surely be improved though. You should open a PR!

Hi, I wrote the wiki for llama-cpp.

I would say it’s not so much a nix config issue, but llama-server that makes it hard to understand, nix translates directly to llama-cpp config file :sweat_smile:

When you open hugging face, you’ll see this on the right side panel the quantization (ollama by default chooses this for you):

You have to choose one, it depends on your hardware (see the performance section), but generally, a good default is Q4_K_M (I’ll try to add a quantization section).

Once you click on it, you will see the hf-file:

Next part of the puzzle is hf-repo which is just in the URL: DavidAU/Qwen3.5-9B-The-Defiant-Fable-Uncensored-Heretic-NEO-IMATRIX-MAX-MTP-GGUF

Finally, alias is just the name you want to see on the llama ui.

You can find all the server parameters on llama-cpp/server (I’ve added it to the wiki)

Hope it helps, and feel free to update the wiki.