From 11e581b45db1fddf8633bbf40ae996f8402ed62a Mon Sep 17 00:00:00 2001 From: ditsuke Date: Fri, 23 Feb 2024 23:01:19 +0530 Subject: [PATCH] build(nix): Refactor gguf-py derivation to take in exact deps --- .devops/nix/package-gguf-py.nix | 10 ++++++---- .devops/nix/scope.nix | 11 ++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.devops/nix/package-gguf-py.nix b/.devops/nix/package-gguf-py.nix index 944ebd700..ee73150d4 100644 --- a/.devops/nix/package-gguf-py.nix +++ b/.devops/nix/package-gguf-py.nix @@ -1,15 +1,17 @@ { lib, llamaVersion, - python3, + numpy, + poetry-core, + buildPythonPackage, }@inputs: -python3.pkgs.buildPythonPackage rec { +buildPythonPackage { pname = "gguf"; version = llamaVersion; pyproject = true; - nativeBuildInputs = with python3.pkgs; [ poetry-core ]; - propagatedBuildInputs = with python3.pkgs; [ numpy ]; + nativeBuildInputs = [ poetry-core ]; + propagatedBuildInputs = [ numpy ]; src = lib.cleanSource ../../gguf-py; doCheck = false; meta = with lib; { diff --git a/.devops/nix/scope.nix b/.devops/nix/scope.nix index eaf7d7a27..abef51fd3 100644 --- a/.devops/nix/scope.nix +++ b/.devops/nix/scope.nix @@ -1,16 +1,25 @@ { lib, newScope, + python3, llamaVersion ? "0.0.0", }: +let + pythonPackages = python3.pkgs; + buildPythonPackage = pythonPackages.buildPythonPackage; + numpy = pythonPackages.numpy; + poetry-core = pythonPackages.poetry-core; +in + # We're using `makeScope` instead of just writing out an attrset # because it allows users to apply overlays later using `overrideScope'`. # Cf. https://noogle.dev/f/lib/makeScope lib.makeScope newScope (self: { inherit llamaVersion; - gguf-py = self.callPackage ./package-gguf-py.nix { }; + pp = python3.pkgs; + gguf-py = self.callPackage ./package-gguf-py.nix { inherit buildPythonPackage numpy poetry-core; }; llama-cpp = self.callPackage ./package.nix { }; docker = self.callPackage ./docker.nix { }; docker-min = self.callPackage ./docker.nix { interactive = false; };