diff --git a/pkgs/by-name/ollamaPackages/mkOllamaModel.nix b/pkgs/by-name/ollamaPackages/mkOllamaModel.nix index a0102bf72..6a72ec9c3 100644 --- a/pkgs/by-name/ollamaPackages/mkOllamaModel.nix +++ b/pkgs/by-name/ollamaPackages/mkOllamaModel.nix @@ -85,6 +85,32 @@ stdenv.mkDerivation { runHook postInstall ''; + checkPhase = '' + runHook preCheck + + # diagnostics for when packaging models: use the manifestBlob, systemBlob output here in your nix expression + echo "manifest:" + cat manifest + + printBlob() { + local blobType="$1" + local blobHash=$(cat manifest | jq ".layers.[] | select(.mediaType == \"application/vnd.ollama.image.$blobType\") | .digest[7:]") + if [ -n "$blobHash" ]; then + printf " %sBlob = %s;\n" "$blobType" "$blobHash" + fi + } + + echo "blobs:" + printBlob model + printBlob params + printBlob system + printBlob ensureDoesntFailForNonExistentBlob + + runHook postCheck + ''; + + doCheck = true; + env.blobDir = "share/ollama/models/blobs"; env.manifestDir = "share/ollama/models/manifests/registry.ollama.ai/library/${modelName}"; env.variant = variant;