shell-gpt: refactor

This commit is contained in:
Fabian Affolter 2024-04-30 16:44:48 +02:00
parent 171fee1478
commit 08150fb723

View File

@ -1,48 +1,54 @@
{ lib { lib
, fetchFromGitHub
, python3 , python3
, fetchPypi
, nix-update-script
}: }:
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
pname = "shell_gpt"; pname = "shell-gpt";
version = "1.4.3"; version = "1.4.3";
pyproject = true; pyproject = true;
src = fetchPypi { src = fetchFromGitHub {
inherit pname version; owner = "TheR1D";
sha256 = "sha256-zSgWSC60ypOQ1IENcxObBezAfHosQWBD9ft06yh5iV4="; 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; [ nativeBuildInputs = with python3.pkgs; [
python3.pkgs.pythonRelaxDepsHook pythonRelaxDepsHook
python3
pip
]; ];
propagatedBuildInputs = with python3.pkgs; [ propagatedBuildInputs = with python3.pkgs; [
markdown-it-py click
rich
distro distro
typer
requests
hatchling
openai
instructor instructor
openai
rich
typer
]; ];
pythonRelaxDeps = [ "requests" "rich" "distro" "typer" ]; # Tests want to read the OpenAI API key from stdin
passthru.updateScript = nix-update-script { };
doCheck = false; doCheck = false;
meta = with lib; { meta = with lib; {
mainProgram = "sgpt";
homepage = "https://github.com/TheR1D/shell_gpt";
description = "Access ChatGPT from your terminal"; 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; license = licenses.mit;
maintainers = with maintainers; [ mglolenstine ]; maintainers = with maintainers; [ mglolenstine ];
mainProgram = "sgpt";
}; };
} }