build(nix): Refactor to new scope for gguf-py

This commit is contained in:
ditsuke 2024-02-22 22:44:35 +05:30
parent c3bc2f6ddf
commit f363d308a4
No known key found for this signature in database
GPG key ID: 71B6C31C8A5A9D21
3 changed files with 24 additions and 19 deletions

View file

@ -0,0 +1,20 @@
{
lib,
llamaVersion,
python3,
}@inputs:
python3.pkgs.buildPythonPackage rec {
pname = "gguf";
version = llamaVersion;
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ poetry-core ];
propagatedBuildInputs = with python3.pkgs; [ numpy ];
src = lib.cleanSource ../../gguf-py;
doCheck = false;
meta = with lib; {
description = "Python package for writing binary files in the GGUF format";
license = licenses.mit;
maintainers = [ maintainers.ditsuke ];
};
}

View file

@ -30,7 +30,8 @@
&& blas.meta.available,
useCuda ? config.cudaSupport,
useMetalKit ? stdenv.isAarch64 && stdenv.isDarwin,
useMpi ? false, # Increases the runtime closure size by ~700M
# Increases the runtime closure size by ~700M
useMpi ? false,
useRocm ? config.rocmSupport,
enableCurl ? true,
useVulkan ? false,
@ -41,6 +42,7 @@
effectiveStdenv ? if useCuda then cudaPackages.backendStdenv else stdenv,
enableStatic ? effectiveStdenv.hostPlatform.isStatic,
precompileMetalShaders ? false,
gguf-py,
}@inputs:
let
@ -70,24 +72,6 @@ let
) ", accelerated with ${strings.concatStringsSep ", " suffices}";
executableSuffix = effectiveStdenv.hostPlatform.extensions.executable;
gguf-py = python3.pkgs.buildPythonPackage rec {
pname = "gguf";
version = "0.0.0";
pyproject = true;
nativeBuildInputs = with python3.pkgs; [ poetry-core ];
# buildInputs = [
# python3.pkgs.poetry-core
# ];
propagatedBuildInputs = with python3.pkgs; [ numpy ];
src = lib.cleanSource ../../gguf-py;
doCheck = false;
meta = with lib; {
description = "Python package for writing binary files in the GGU format";
license = licenses.mit;
maintainers = [ maintainers.philiptaron ];
};
};
# TODO: package the Python in this repository in a Nix-like way.
# It'd be nice to migrate to buildPythonPackage, as well as ensure this repo

View file

@ -10,6 +10,7 @@
lib.makeScope newScope (self: {
inherit llamaVersion;
gguf-py = self.callPackage ./package-gguf-py.nix { };
llama-cpp = self.callPackage ./package.nix { };
docker = self.callPackage ./docker.nix { };
docker-min = self.callPackage ./docker.nix { interactive = false; };