From 08150fb723af988f1e57ea1592698c2ff7b56f5b Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 30 Apr 2024 16:44:48 +0200 Subject: [PATCH] shell-gpt: refactor --- pkgs/by-name/sh/shell-gpt/package.nix | 50 +++++++++++++++------------ 1 file 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 4db72ae50586..a7eae5f68ad9 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"; }; }