nixpkgs/pkgs/development/python-modules/pre-commit-hooks/default.nix
Martin Weinelt 8ea6bde88d
treewide: prune pythonOlder 3.10/3.11
This is a post 3.10 removal cleanup.
2026-02-15 04:33:54 +01:00

56 lines
1.3 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
gitMinimal,
pytestCheckHook,
ruamel-yaml,
setuptools,
}:
buildPythonPackage rec {
pname = "pre-commit-hooks";
version = "6.0.0";
pyproject = true;
src = fetchFromGitHub {
owner = "pre-commit";
repo = "pre-commit-hooks";
tag = "v${version}";
hash = "sha256-pxtsnRryTguNGYbdiQ55UhuRyJTQvFfaqVOTcCz2jgk=";
};
build-system = [ setuptools ];
dependencies = [ ruamel-yaml ];
nativeCheckInputs = [
gitMinimal
pytestCheckHook
];
# Note: this is not likely to ever work on Darwin
# https://github.com/pre-commit/pre-commit-hooks/pull/655
doCheck = !stdenv.hostPlatform.isDarwin;
# the tests require a functional git installation which requires a valid HOME
# directory.
preCheck = ''
export HOME="$(mktemp -d)"
git config --global user.name "Nix Builder"
git config --global user.email "nix-builder@nixos.org"
git init .
'';
pythonImportsCheck = [ "pre_commit_hooks" ];
meta = {
description = "Some out-of-the-box hooks for pre-commit";
homepage = "https://github.com/pre-commit/pre-commit-hooks";
changelog = "https://github.com/pre-commit/pre-commit-hooks/blob/${src.tag}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ kalbasit ];
};
}