From ded8563fb360bf5c7b1283236cfaef1772903ee9 Mon Sep 17 00:00:00 2001 From: Kai Harries Date: Thu, 21 Dec 2023 12:22:38 +0100 Subject: [PATCH] llama-cpp: assert that only one of the *Support arguments is true When experimenting with llama-cpp I experienced a mysterious build error that in the end I tracked down to me setting openclSupport and openblasSupport to true. To prevent others from this mistake add an assert that complains if more than one of the arguments openclSupport, openblasSupport and rocmSupport is set to true. --- pkgs/by-name/ll/llama-cpp/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/ll/llama-cpp/package.nix b/pkgs/by-name/ll/llama-cpp/package.nix index 77a452a26cb0..e82c7467ba7d 100644 --- a/pkgs/by-name/ll/llama-cpp/package.nix +++ b/pkgs/by-name/ll/llama-cpp/package.nix @@ -22,6 +22,10 @@ , pkg-config }: +assert lib.assertMsg + (lib.count lib.id [openclSupport openblasSupport rocmSupport] == 1) + "llama-cpp: exactly one of openclSupport, openblasSupport and rocmSupport should be enabled"; + let cudatoolkit_joined = symlinkJoin { name = "${cudaPackages.cudatoolkit.name}-merged";