1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 jq,
6 curl,
7 glow,
8 makeWrapper,
9}:
10
11let
12 pname = "chatgpt-shell-cli";
13
14 # no tags
15 version = "master";
16in
17stdenv.mkDerivation {
18 inherit pname version;
19
20 src = fetchFromGitHub {
21 owner = "0xacx";
22 repo = "chatgpt-shell-cli";
23 rev = version;
24 hash = "sha256-hYLrUya4UCsIB1J/n+jp1jFRCEqnGFJOr3ATxm0zwdY=";
25 };
26
27 nativeBuildInputs = [ makeWrapper ];
28
29 installPhase = ''
30 runHook preInstall
31
32 mkdir -p $out/bin
33 install -Dm755 chatgpt.sh -t $out/bin
34
35 runHook postInstall
36 '';
37
38 postInstall = ''
39 wrapProgram $out/bin/chatgpt.sh \
40 --prefix PATH : ${
41 lib.makeBinPath [
42 jq
43 curl
44 glow
45 ]
46 }
47 '';
48
49 meta = with lib; {
50 homepage = "https://github.com/0xacx/chatGPT-shell-cli";
51 description = "Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required";
52 license = licenses.mit;
53 maintainers = with maintainers; [ jfvillablanca ];
54 };
55}