diff --git a/pkgs/llm/llm-anthropic/default.nix b/pkgs/llm/llm-anthropic/default.nix index 883952d..b072ba6 100644 --- a/pkgs/llm/llm-anthropic/default.nix +++ b/pkgs/llm/llm-anthropic/default.nix @@ -1,3 +1,8 @@ +{ + version, + hash, +}: + { buildPythonPackage, fetchFromGitHub, @@ -11,16 +16,16 @@ ... }: -buildPythonPackage rec { +buildPythonPackage { + inherit version; pname = "llm-anthropic"; - version = "0.12"; pyproject = true; src = fetchFromGitHub { owner = "simonw"; repo = "llm-anthropic"; rev = version; - hash = "sha256-7+5j5jZBFfaaqnfjvLTI+mz1PUuG8sB5nD59UCpJuR4="; + inherit hash; }; nativeBuildInputs = [ diff --git a/pkgs/llm/llm-cmd/default.nix b/pkgs/llm/llm-cmd/default.nix index 8a40522..b01e90d 100644 --- a/pkgs/llm/llm-cmd/default.nix +++ b/pkgs/llm/llm-cmd/default.nix @@ -1,3 +1,4 @@ +{ version, hash }: { buildPythonPackage, fetchFromGitHub, @@ -12,16 +13,16 @@ ... }: -buildPythonPackage rec { +buildPythonPackage { + inherit version; pname = "llm-cmd"; - version = "0.2a0"; pyproject = true; src = fetchFromGitHub { owner = "simonw"; repo = "llm-cmd"; rev = version; - hash = "sha256-RhwQEllpee/XP1p0nrgL4m+KjSZzf61J8l1jJGlg94E="; + inherit hash; }; nativeBuildInputs = [ diff --git a/pkgs/llm/llm-gemini/default.nix b/pkgs/llm/llm-gemini/default.nix index 3aef81f..8d5c699 100644 --- a/pkgs/llm/llm-gemini/default.nix +++ b/pkgs/llm/llm-gemini/default.nix @@ -1,3 +1,4 @@ +{ version, hash }: { buildPythonPackage, fetchFromGitHub, @@ -12,16 +13,16 @@ ... }: -buildPythonPackage rec { +buildPythonPackage { + inherit version; pname = "llm-gemini"; - version = "0.10"; pyproject = true; src = fetchFromGitHub { owner = "simonw"; repo = "llm-gemini"; rev = version; - hash = "sha256-+ghsBvEY8GQAphdvG7Rdu3T/7yz64vmkuA1VGvqw1fU="; + inherit hash; }; nativeBuildInputs = [ diff --git a/pkgs/llm/llm-jq/default.nix b/pkgs/llm/llm-jq/default.nix index aad8309..65b7fdd 100644 --- a/pkgs/llm/llm-jq/default.nix +++ b/pkgs/llm/llm-jq/default.nix @@ -1,3 +1,4 @@ +{ version, hash }: { buildPythonPackage, fetchFromGitHub, @@ -9,16 +10,17 @@ ... }: -buildPythonPackage rec { +buildPythonPackage { + inherit version; pname = "llm-jq"; - version = "0.1.1"; pyproject = true; src = fetchFromGitHub { owner = "simonw"; repo = "llm-jq"; rev = version; - hash = "sha256-Mf/tbB9+UdmSRpulqv5Wagr8wjDcRrNs2741DNQZhO4="; + inherit hash; + }; nativeBuildInputs = [ diff --git a/pkgs/llm/llm-python/default.nix b/pkgs/llm/llm-python/default.nix new file mode 100644 index 0000000..0d992f6 --- /dev/null +++ b/pkgs/llm/llm-python/default.nix @@ -0,0 +1,33 @@ +{ version, hash }: +{ + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + wheel, + + ... +}: + +buildPythonPackage { + inherit version; + pname = "llm-python"; + pyproject = true; + + src = fetchFromGitHub { + owner = "simonw"; + repo = "llm-python"; + rev = version; + inherit hash; + }; + + nativeBuildInputs = [ + setuptools + wheel + ]; + + dependencies = [ ]; + + dontCheckRuntimeDeps = true; +} diff --git a/pkgs/llm/llm-with-plugins/default.nix b/pkgs/llm/llm-with-plugins/default.nix index f18847f..0d46ebb 100644 --- a/pkgs/llm/llm-with-plugins/default.nix +++ b/pkgs/llm/llm-with-plugins/default.nix @@ -3,16 +3,36 @@ ... }: let + inherit (builtins) mapAttrs attrValues; inherit (pkgs) python3Packages; - llm = python3Packages.callPackage ../llm { }; - plugins = [ - "anthropic" - "gemini" - "cmd" - "jq" - ]; + mkPlugin = name: attrs: python3Packages.callPackage (import (../. + "/llm-${name}") attrs) { }; - pluginPackages = plugins |> map (name: python3Packages.callPackage (../. + "/llm-${name}") { }); + llm = python3Packages.callPackage ../llm { }; + + pluginAttr = { + anthropic = { + version = "0.12"; + hash = "sha256-7+5j5jZBFfaaqnfjvLTI+mz1PUuG8sB5nD59UCpJuR4="; + }; + gemini = { + version = "0.10"; + hash = "sha256-+ghsBvEY8GQAphdvG7Rdu3T/7yz64vmkuA1VGvqw1fU="; + }; + cmd = { + version = "0.2a0"; + hash = "sha256-RhwQEllpee/XP1p0nrgL4m+KjSZzf61J8l1jJGlg94E="; + }; + jq = { + version = "0.1.1"; + hash = "sha256-Mf/tbB9+UdmSRpulqv5Wagr8wjDcRrNs2741DNQZhO4="; + }; + python = { + version = "0.1"; + hash = "sha256-Z991f0AGO5iaCeoG9dkFhTLtuR45PgCS9awCvOAuPPs="; + }; + }; + + pluginPackages = pluginAttr |> mapAttrs mkPlugin |> attrValues; pyWithLlm = ( pkgs.python3.withPackages (