Skip to content

Commit

Permalink
build(nix): Refactor gguf-py derivation to take in exact deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ditsuke committed Feb 23, 2024
1 parent 9f6aa95 commit 4957125
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 6 additions & 4 deletions .devops/nix/package-gguf-py.nix
Original file line number Diff line number Diff line change
@@ -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; {
Expand Down
11 changes: 10 additions & 1 deletion .devops/nix/scope.nix
Original file line number Diff line number Diff line change
@@ -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; };
llama-cpp = self.callPackage ./package.nix { };
docker = self.callPackage ./docker.nix { };
docker-min = self.callPackage ./docker.nix { interactive = false; };
Expand Down

0 comments on commit 4957125

Please sign in to comment.