build(nix): Refactor gguf-py derivation to take in exact deps

This commit is contained in:
ditsuke 2024-02-23 23:01:19 +05:30
parent 0b8ddf8694
commit 11e581b45d
No known key found for this signature in database
GPG key ID: 71B6C31C8A5A9D21
2 changed files with 16 additions and 5 deletions

View file

@ -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; {

View file

@ -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; };