Home

dotnix @main - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
dotnix / apps / nogui / llm.nix
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ pkgs, lib, ... }:
let
  claude =
    let
      inherit (pkgs) fetchFromGitHub nix-update-script python3Packages;
      inherit (python3Packages)
        buildPythonPackage
        setuptools
        anthropic
        llm
        pytestCheckHook
        pytest
        pytest-recording
        ;
    in
    buildPythonPackage rec {
      pname = "llm-claude-3";
      version = "0.4";
      pyproject = true;

      src = fetchFromGitHub {
        owner = "simonw";
        repo = "llm-claude-3";
        rev = "refs/tags/${version}";
        hash = "sha256-5qF5BK319PNzB4XsLdYvtyq/SxBDdHJ9IoKWEnvNRp4=";
      };

      build-system = [ setuptools ];
      buildInputs = [ llm ];
      dependencies = [ anthropic ];
      optional-dependencies = {
        test = [
          pytest
          pytest-recording
        ];
      };

      # Test suite requires network access to talk to Claude (duh).
      nativeCheckInputs = [ pytestCheckHook ];
      doCheck = false;
      pythonImportsCheck = [ "llm_claude_3" ];

      passthru.updateScript = nix-update-script { };

      meta = {
        description = "LLM plugin for interacting with the Claude 3 family of models";
        homepage = "https://github.com/simonw/llm-claude-3";
        license = lib.licenses.asl20;
        maintainers = with lib.maintainers; [ jkachmar ];
      };
    };
  pyWithPackages = (
    pkgs.python3.withPackages (py: [
      py.llm
      claude
    ])
  );
in
{
  home.packages = [
    (pkgs.runCommand "llm" { } ''
      mkdir -p $out/bin
      ln -s ${pyWithPackages}/bin/llm $out/bin/llm
    '')
  ];
}