1{
2 lib,
3 callPackage,
4 buildPythonPackage,
5 fetchFromGitHub,
6 # build-system
7 setuptools,
8 llm,
9 # dependencies
10 prompt-toolkit,
11 pygments,
12 # tests
13 pytestCheckHook,
14}:
15
16buildPythonPackage rec {
17 pname = "llm-cmd";
18 version = "0.2a0";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "simonw";
23 repo = "llm-cmd";
24 tag = version;
25 hash = "sha256-RhwQEllpee/XP1p0nrgL4m+KjSZzf61J8l1jJGlg94E=";
26 };
27
28 # Only needed until https://github.com/simonw/llm-cmd/pull/18 is merged and released
29 patches = [ ./fix-test.patch ];
30 build-system = [
31 setuptools
32 # Follows the reasoning from https://github.com/NixOS/nixpkgs/pull/327800#discussion_r1681586659 about including llm in build-system
33 llm
34 ];
35
36 dependencies = [
37 prompt-toolkit
38 pygments
39 ];
40
41 nativeCheckInputs = [
42 pytestCheckHook
43 ];
44
45 pythonImportsCheck = [
46 "llm_cmd"
47 ];
48
49 passthru.tests = {
50 llm-plugin = callPackage ./tests/llm-plugin.nix { };
51 };
52
53 meta = {
54 description = "Use LLM to generate and execute commands in your shell";
55 homepage = "https://github.com/simonw/llm-cmd";
56 changelog = "https://github.com/simonw/llm-cmd/releases/tag/${version}";
57 license = lib.licenses.asl20;
58 maintainers = with lib.maintainers; [ erethon ];
59 };
60}