From b590908c9e7a7ad4149d85607438acd9061e3387 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Wed, 28 Feb 2024 20:54:43 -0300 Subject: [PATCH] duden: refactor - get rid of rec by using recursive let - do not use python3.pkgs (oh that splicing dark magic) - get rid of nested with - set meta.mainProgram - adopted by AndersonTorres --- .../python-modules/duden/default.nix | 84 +++++++++++-------- 1 file changed, 50 insertions(+), 34 deletions(-) diff --git a/pkgs/development/python-modules/duden/default.nix b/pkgs/development/python-modules/duden/default.nix index 0d310e8c23dc..a28ae2e1291a 100644 --- a/pkgs/development/python-modules/duden/default.nix +++ b/pkgs/development/python-modules/duden/default.nix @@ -1,40 +1,56 @@ { lib -, python3 +, beautifulsoup4 +, buildPythonPackage +, crayons , fetchFromGitHub +, poetry-core +, pyxdg +, pyyaml +, requests +, setuptools }: -python3.pkgs.buildPythonPackage rec { - pname = "duden"; - version = "0.18.0"; - format = "pyproject"; +let + finalAttrs = { + pname = "duden"; + version = "0.18.0"; + pyproject = true; - src = fetchFromGitHub { - owner = "radomirbosak"; - repo = "duden"; - rev = version; - hash = "sha256-ZrarN09Znw4m6YiZxD7q7dTJ49WjmHDobLnOt8JCwvc="; + src = fetchFromGitHub { + owner = "radomirbosak"; + repo = "duden"; + rev = finalAttrs.version; + hash = "sha256-ZrarN09Znw4m6YiZxD7q7dTJ49WjmHDobLnOt8JCwvc="; + }; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + beautifulsoup4 + crayons + pyxdg + pyyaml + requests + setuptools + ]; + + pythonImportsCheck = [ "duden" ]; + + meta = { + homepage = "https://github.com/radomirbosak/duden"; + changelog = "https://github.com/radomirbosak/duden/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + description = "CLI for https://duden.de dictionary written in Python"; + longDescription = '' + duden is a CLI-based program and python module, which can provide + various information about given german word. The provided data are + parsed from german dictionary duden.de. + ''; + license = with lib.licenses; [ mit ]; + mainProgram = "duden"; + maintainers = with lib.maintainers; [ AndersonTorres ]; + }; }; - - nativeBuildInputs = [ - python3.pkgs.poetry-core - ]; - - propagatedBuildInputs = with python3.pkgs; [ - beautifulsoup4 - crayons - pyxdg - pyyaml - requests - setuptools - ]; - - pythonImportsCheck = [ "duden" ]; - - meta = with lib; { - description = "CLI for http://duden.de dictionary written in Python"; - homepage = "https://github.com/radomirbosak/duden"; - changelog = "https://github.com/radomirbosak/duden/blob/${src.rev}/CHANGELOG.md"; - license = licenses.mit; - maintainers = with maintainers; [ ]; - }; -} +in +buildPythonPackage finalAttrs