about summary refs log tree commit diff
path: root/pkgs/by-name/ch/chatgpt-shell-cli/package.nix
blob: 25ab95c94127d79aa72a5e3a3c3bc79c356cb172 (plain) (blame)
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
{ lib
, stdenv
, fetchFromGitHub
, jq
, curl
, glow
, makeWrapper
}:

let
  pname = "chatgpt-shell-cli";

  # no tags
  version = "master";
in
stdenv.mkDerivation {
    inherit pname version;

    src = fetchFromGitHub {
      owner = "0xacx";
      repo = "chatgpt-shell-cli";
      rev = version;
      hash = "sha256-hYLrUya4UCsIB1J/n+jp1jFRCEqnGFJOr3ATxm0zwdY=";
    };

    nativeBuildInputs = [ makeWrapper ];

    installPhase = ''
      runHook preInstall

      mkdir -p $out/bin
      install -Dm755 chatgpt.sh -t $out/bin

      runHook postInstall
    '';

    postInstall = ''
      wrapProgram $out/bin/chatgpt.sh \
        --prefix PATH : ${lib.makeBinPath [ jq curl glow ]}
    '';

    meta = with lib; {
      homepage = "https://github.com/0xacx/chatGPT-shell-cli";
      description = "Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.";
      license = licenses.mit;
      maintainers = with maintainers; [ jfvillablanca ];
    };
  }