From f363d308a4f5947e05dfb8ccbb601d028a73a248 Mon Sep 17 00:00:00 2001 From: ditsuke Date: Thu, 22 Feb 2024 22:44:35 +0530 Subject: [PATCH] build(nix): Refactor to new scope for gguf-py --- .devops/nix/package-gguf-py.nix | 20 ++++++++++++++++++++ .devops/nix/package.nix | 22 +++------------------- .devops/nix/scope.nix | 1 + 3 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 .devops/nix/package-gguf-py.nix diff --git a/.devops/nix/package-gguf-py.nix b/.devops/nix/package-gguf-py.nix new file mode 100644 index 000000000..944ebd700 --- /dev/null +++ b/.devops/nix/package-gguf-py.nix @@ -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 ]; + }; +} diff --git a/.devops/nix/package.nix b/.devops/nix/package.nix index f5a6c0d7d..6f797431d 100644 --- a/.devops/nix/package.nix +++ b/.devops/nix/package.nix @@ -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 diff --git a/.devops/nix/scope.nix b/.devops/nix/scope.nix index d9fc1fdf0..eaf7d7a27 100644 --- a/.devops/nix/scope.nix +++ b/.devops/nix/scope.nix @@ -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; };