Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 19 additions & 26 deletions pkgs/by-name/ol/ollama/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ assert builtins.elem acceleration [
];

let
pname = "ollama";
# don't forget to invalidate all hashes each update
version = "0.6.5";

src = fetchFromGitHub {
owner = "ollama";
repo = "ollama";
tag = "v${version}";
hash = "sha256-l+JYQjl6A0fKONxtgCtc0ztT18rmArGKcO2o+p4H95M=";
fetchSubmodules = true;
};

vendorHash = "sha256-4wYgtdCHvz+ENNMiHptu6ulPJAznkWetQcdba3IEB6s=";

validateFallback = lib.warnIf (config.rocmSupport && config.cudaSupport) (lib.concatStrings [
"both `nixpkgs.config.rocmSupport` and `nixpkgs.config.cudaSupport` are enabled, "
"but they are mutually exclusive; falling back to cpu"
Expand Down Expand Up @@ -136,13 +122,20 @@ let
buildGoModule;
inherit (lib) licenses platforms maintainers;
in
goBuild {
inherit
pname
version
src
vendorHash
;
goBuild (finalAttrs: {
pname = "ollama";
# don't forget to invalidate all hashes each update
version = "0.6.5";

src = fetchFromGitHub {
owner = "ollama";
repo = "ollama";
tag = "v${finalAttrs.version}";
hash = "sha256-l+JYQjl6A0fKONxtgCtc0ztT18rmArGKcO2o+p4H95M=";
fetchSubmodules = true;
};

vendorHash = "sha256-4wYgtdCHvz+ENNMiHptu6ulPJAznkWetQcdba3IEB6s=";

env =
lib.optionalAttrs enableRocm {
Expand Down Expand Up @@ -184,7 +177,7 @@ goBuild {
# replace inaccurate version number with actual release version
postPatch = ''
substituteInPlace version/version.go \
--replace-fail 0.0.0 '${version}'
--replace-fail 0.0.0 '${finalAttrs.version}'
'';

overrideModAttrs = (
Expand Down Expand Up @@ -240,7 +233,7 @@ goBuild {
ldflags = [
"-s"
"-w"
"-X=github.com/ollama/ollama/version.Version=${version}"
"-X=github.com/ollama/ollama/version.Version=${finalAttrs.version}"
"-X=github.com/ollama/ollama/server.mode=release"
];

Expand All @@ -251,7 +244,7 @@ goBuild {
{
inherit ollama;
version = testers.testVersion {
inherit version;
inherit (finalAttrs) version;
package = ollama;
};
}
Expand All @@ -269,7 +262,7 @@ goBuild {
+ lib.optionalString rocmRequested ", using ROCm for AMD GPU acceleration"
+ lib.optionalString cudaRequested ", using CUDA for NVIDIA GPU acceleration";
homepage = "https://github.com/ollama/ollama";
changelog = "https://github.com/ollama/ollama/releases/tag/v${version}";
changelog = "https://github.com/ollama/ollama/releases/tag/v${finalAttrs.version}";
license = licenses.mit;
platforms = if (rocmRequested || cudaRequested) then platforms.linux else platforms.unix;
mainProgram = "ollama";
Expand All @@ -281,4 +274,4 @@ goBuild {
roydubnium
];
};
}
})