nixpkgs/pkgs/by-name/py/pyp/package.nix
Anderson Torres cd975261c7 pyp: migrate it to by-name hierarchy
Since it is not used as library, it makes no sense to deploy it as a library.
2024-03-08 15:59:12 -03:00

61 lines
1.2 KiB
Nix

{ lib
, bc
, fetchFromGitHub
, jq
, python3
}:
let
pythonPackages = python3.pkgs;
finalAttrs = {
pname = "pyp";
version = "1.2.0";
src = fetchFromGitHub {
owner = "hauntsaninja";
repo = "pyp";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-hnEgqWOIVj2ugOhd2aS9IulfkVnrlkhwOtrgH4qQqO8=";
};
pyproject = true;
build-system = with pythonPackages; [
flit-core
];
nativeCheckInputs = (with pythonPackages; [
pytestCheckHook
]) ++ [
bc
jq
];
pythonImportsCheck = [
"pyp"
];
# without this, the tests fail because they are unable to find the pyp tool
# itself...
preCheck = ''
_OLD_PATH_=$PATH
PATH=$out/bin:$PATH
'';
# And a cleanup!
postCheck = ''
PATH=$_OLD_PATH_
'';
meta = {
homepage = "https://github.com/hauntsaninja/pyp";
description = "Easily run Python at the shell";
changelog = "https://github.com/hauntsaninja/pyp/blob/${finalAttrs.version}/CHANGELOG.md";
license = with lib.licenses; [ mit ];
mainProgram = "pyp";
maintainers = with lib.maintainers; [ rmcgibbo AndersonTorres ];
};
};
in
pythonPackages.buildPythonPackage finalAttrs