about summary refs log tree commit diff
path: root/pkgs/by-name/sh
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2024-04-30 16:44:48 +0200
committerFabian Affolter <mail@fabian-affolter.ch>2024-04-30 16:44:48 +0200
commit08150fb723af988f1e57ea1592698c2ff7b56f5b (patch)
treec4002c1e4c3c1f705da6345da1a142e73df54d68 /pkgs/by-name/sh
parent171fee1478fd872376750f9a0e4f34a2f2202c29 (diff)
shell-gpt: refactor
Diffstat (limited to 'pkgs/by-name/sh')
-rw-r--r--pkgs/by-name/sh/shell-gpt/package.nix50
1 files changed, 28 insertions, 22 deletions
diff --git a/pkgs/by-name/sh/shell-gpt/package.nix b/pkgs/by-name/sh/shell-gpt/package.nix
index 4db72ae505864..a7eae5f68ad9c 100644
--- a/pkgs/by-name/sh/shell-gpt/package.nix
+++ b/pkgs/by-name/sh/shell-gpt/package.nix
@@ -1,48 +1,54 @@
 { lib
+, fetchFromGitHub
 , python3
-, fetchPypi
-, nix-update-script
 }:
 
 python3.pkgs.buildPythonApplication rec {
-  pname = "shell_gpt";
+  pname = "shell-gpt";
   version = "1.4.3";
   pyproject = true;
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "sha256-zSgWSC60ypOQ1IENcxObBezAfHosQWBD9ft06yh5iV4=";
+  src = fetchFromGitHub {
+    owner = "TheR1D";
+    repo = "shell_gpt";
+    rev = "refs/tags/${version}";
+    hash = "sha256-T37L4U1kOrrIQJ2znq2UupD3pyit9xd8rAsEwUvGiQ8=";
   };
 
+  pythonRelaxDeps = [
+    "requests"
+    "rich"
+    "distro"
+    "typer" 
+    "instructor"
+  ];
+
+  build-system = with python3.pkgs; [
+    hatchling
+  ];
+
   nativeBuildInputs = with python3.pkgs; [
-    python3.pkgs.pythonRelaxDepsHook
-    python3
-    pip
+    pythonRelaxDepsHook
   ];
 
   propagatedBuildInputs = with python3.pkgs; [
-    markdown-it-py
-    rich
+    click
     distro
-    typer
-    requests
-    hatchling
-    openai
     instructor
+    openai
+    rich
+    typer
   ];
 
-  pythonRelaxDeps = [ "requests" "rich" "distro" "typer" ];
-
-  passthru.updateScript = nix-update-script { };
-
+  # Tests want to read the OpenAI API key from stdin
   doCheck = false;
 
   meta = with lib; {
-    mainProgram = "sgpt";
-    homepage = "https://github.com/TheR1D/shell_gpt";
     description = "Access ChatGPT from your terminal";
-    platforms = platforms.unix;
+    homepage = "https://github.com/TheR1D/shell_gpt";
+    changelog = "https://github.com/TheR1D/shell_gpt/releases/tag/${version}";
     license = licenses.mit;
     maintainers = with maintainers; [ mglolenstine ];
+    mainProgram = "sgpt";
   };
 }