2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
2021-12-30 13:39:12 +00:00
|
|
|
, stdenv
|
2021-07-14 22:03:04 +00:00
|
|
|
, buildPythonPackage
|
2020-12-25 13:55:36 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, git
|
|
|
|
, pytestCheckHook
|
2021-12-30 13:39:12 +00:00
|
|
|
, pythonOlder
|
2021-12-06 16:07:01 +00:00
|
|
|
, ruamel-yaml
|
2020-12-25 13:55:36 +00:00
|
|
|
, toml
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pre-commit-hooks";
|
2022-04-15 01:41:22 +00:00
|
|
|
version = "4.2.0";
|
2021-12-30 13:39:12 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pre-commit";
|
|
|
|
repo = pname;
|
2022-04-15 01:41:22 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
sha256 = "sha256-jSu4LutEgpeAbCgSHgk6VXQKLZo00T3TrQVZxsNU1co=";
|
2020-12-25 13:55:36 +00:00
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-12-06 16:07:01 +00:00
|
|
|
ruamel-yaml
|
2021-07-14 22:03:04 +00:00
|
|
|
toml
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
git
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2020-12-25 13:55:36 +00:00
|
|
|
|
2021-12-24 04:21:11 +00:00
|
|
|
# Note: this is not likely to ever work on Darwin
|
|
|
|
# https://github.com/pre-commit/pre-commit-hooks/pull/655
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
# 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"
|
2021-12-30 13:39:12 +00:00
|
|
|
git init .
|
2020-12-25 13:55:36 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pre_commit_hooks"
|
|
|
|
];
|
2021-07-14 22:03:04 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Some out-of-the-box hooks for pre-commit";
|
|
|
|
homepage = "https://github.com/pre-commit/pre-commit-hooks";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ kalbasit ];
|
|
|
|
};
|
|
|
|
}
|