From 6e9650ad5000290fc439e072b022cf44dca341a7 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:04:13 +0300 Subject: [PATCH 1/5] koboldcpp: drop unused args --- pkgs/by-name/ko/koboldcpp/package.nix | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/pkgs/by-name/ko/koboldcpp/package.nix b/pkgs/by-name/ko/koboldcpp/package.nix index 40cc23278ea7..aaeb69a831da 100644 --- a/pkgs/by-name/ko/koboldcpp/package.nix +++ b/pkgs/by-name/ko/koboldcpp/package.nix @@ -5,7 +5,6 @@ makeWrapper, gitUpdater, python3Packages, - python311Packages ? null, # Ignored. Kept for compatibility with the release tk, addDriverRunpath, @@ -31,9 +30,7 @@ vulkanSupport ? true, vulkan-loader, - metalSupport ? stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64, - march ? "", - mtune ? "", + metalSupport ? stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 }: let @@ -115,14 +112,6 @@ effectiveStdenv.mkDerivation (finalAttrs: { env.NIX_LDFLAGS = lib.concatStringsSep " " (finalAttrs.darwinLdFlags ++ finalAttrs.metalLdFlags); - env.NIX_CFLAGS_COMPILE = - lib.optionalString (march != "") ( - lib.warn "koboldcpp: the march argument is only kept for compatibility; use overrideAttrs intead" "-march=${march}" - ) - + lib.optionalString (mtune != "") ( - lib.warn "koboldcpp: the mtune argument is only kept for compatibility; use overrideAttrs intead" "-mtune=${mtune}" - ); - makeFlags = [ (makeBool "LLAMA_OPENBLAS" openblasSupport) (makeBool "LLAMA_CUBLAS" cublasSupport) From 466d4657464a62b8da2df28715918c5f9e66f7ac Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:08:07 +0300 Subject: [PATCH 2/5] koboldcpp: migrate to `apple-sdk_12` --- pkgs/by-name/ko/koboldcpp/package.nix | 38 +++------------------------ 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/pkgs/by-name/ko/koboldcpp/package.nix b/pkgs/by-name/ko/koboldcpp/package.nix index aaeb69a831da..6815c89f4705 100644 --- a/pkgs/by-name/ko/koboldcpp/package.nix +++ b/pkgs/by-name/ko/koboldcpp/package.nix @@ -8,7 +8,7 @@ tk, addDriverRunpath, - darwin, + apple-sdk_12, koboldLiteSupport ? true, @@ -29,8 +29,7 @@ vulkanSupport ? true, vulkan-loader, - - metalSupport ? stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 + metalSupport ? stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64, }: let @@ -40,12 +39,6 @@ let --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ addDriverRunpath.driverLink ]}" ''; - darwinFrameworks = - if (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) then - darwin.apple_sdk.frameworks - else - darwin.apple_sdk_11_0.frameworks; - effectiveStdenv = if cublasSupport then cudaPackages.backendStdenv else stdenv; in effectiveStdenv.mkDerivation (finalAttrs: { @@ -71,17 +64,7 @@ effectiveStdenv.mkDerivation (finalAttrs: { buildInputs = [ tk ] ++ finalAttrs.pythonInputs - ++ lib.optionals effectiveStdenv.hostPlatform.isDarwin [ - darwinFrameworks.Accelerate - darwinFrameworks.CoreVideo - darwinFrameworks.CoreGraphics - darwinFrameworks.CoreServices - ] - ++ lib.optionals metalSupport [ - darwinFrameworks.MetalKit - darwinFrameworks.Foundation - darwinFrameworks.MetalPerformanceShaders - ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_12 ] ++ lib.optionals openblasSupport [ openblas ] ++ lib.optionals cublasSupport [ cudaPackages.libcublas @@ -97,21 +80,6 @@ effectiveStdenv.mkDerivation (finalAttrs: { pythonPath = finalAttrs.pythonInputs; - darwinLdFlags = lib.optionals stdenv.hostPlatform.isDarwin [ - "-F${darwinFrameworks.CoreServices}/Library/Frameworks" - "-F${darwinFrameworks.Accelerate}/Library/Frameworks" - "-framework CoreServices" - "-framework Accelerate" - ]; - metalLdFlags = lib.optionals metalSupport [ - "-F${darwinFrameworks.Foundation}/Library/Frameworks" - "-F${darwinFrameworks.Metal}/Library/Frameworks" - "-framework Foundation" - "-framework Metal" - ]; - - env.NIX_LDFLAGS = lib.concatStringsSep " " (finalAttrs.darwinLdFlags ++ finalAttrs.metalLdFlags); - makeFlags = [ (makeBool "LLAMA_OPENBLAS" openblasSupport) (makeBool "LLAMA_CUBLAS" cublasSupport) From 30a3b42239b001ec62ef6f5d97e44304543edb68 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:10:23 +0200 Subject: [PATCH 3/5] koboldcpp: drop `stdenv.hostPlatform.isAarch64` requirement https://github.com/NixOS/nixpkgs/pull/349052#issuecomment-2417739679 --- pkgs/by-name/ko/koboldcpp/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/ko/koboldcpp/package.nix b/pkgs/by-name/ko/koboldcpp/package.nix index 6815c89f4705..78ce1d5eed12 100644 --- a/pkgs/by-name/ko/koboldcpp/package.nix +++ b/pkgs/by-name/ko/koboldcpp/package.nix @@ -29,7 +29,7 @@ vulkanSupport ? true, vulkan-loader, - metalSupport ? stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64, + metalSupport ? stdenv.hostPlatform.isDarwin, }: let From bccff63bbbb1a7746120e2ecc211b4289ecfabd3 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:37:54 +0200 Subject: [PATCH 4/5] koboldcpp: drop `postPatch` --- pkgs/by-name/ko/koboldcpp/package.nix | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pkgs/by-name/ko/koboldcpp/package.nix b/pkgs/by-name/ko/koboldcpp/package.nix index 78ce1d5eed12..f72b76d5ae08 100644 --- a/pkgs/by-name/ko/koboldcpp/package.nix +++ b/pkgs/by-name/ko/koboldcpp/package.nix @@ -110,12 +110,6 @@ effectiveStdenv.mkDerivation (finalAttrs: { runHook postInstall ''; - # Remove an unused argument, mainly intended for Darwin to reduce warnings - postPatch = '' - substituteInPlace Makefile \ - --replace-warn " -s " " " - ''; - postFixup = '' wrapPythonProgramsIn "$out/bin" "$pythonPath" makeWrapper "$out/bin/koboldcpp.unwrapped" "$out/bin/koboldcpp" \ From d626241e242fd883d0cd1e4da950479cf371ba0c Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:41:57 +0200 Subject: [PATCH 5/5] koboldcpp: `gitUpdater` -> `nix-update-script` --- pkgs/by-name/ko/koboldcpp/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ko/koboldcpp/package.nix b/pkgs/by-name/ko/koboldcpp/package.nix index f72b76d5ae08..ddc931b5d5cb 100644 --- a/pkgs/by-name/ko/koboldcpp/package.nix +++ b/pkgs/by-name/ko/koboldcpp/package.nix @@ -30,6 +30,7 @@ vulkanSupport ? true, vulkan-loader, metalSupport ? stdenv.hostPlatform.isDarwin, + nix-update-script, }: let @@ -116,7 +117,7 @@ effectiveStdenv.mkDerivation (finalAttrs: { --prefix PATH : ${lib.makeBinPath [ tk ]} ${libraryPathWrapperArgs} ''; - passthru.updateScript = gitUpdater { rev-prefix = "v"; }; + passthru.updateScript = nix-update-script { }; meta = { changelog = "https://github.com/LostRuins/koboldcpp/releases/tag/v${finalAttrs.version}";