14 buildPythonPackage rec {
17 format = "setuptools";
19 disabled = pythonOlder "3.6";
21 src = fetchFromGitHub {
24 rev = "refs/tags/v${version}";
25 sha256 = "sha256-+JrnJz+wFbzVw9ysPX85DDE6suF3VU7gQZdp66x5TKY=";
29 ./languages-use-the-hardcoded-path-to-python-binaries.patch
33 propagatedBuildInputs = [
40 ] ++ lib.optionals (pythonOlder "3.8") [
42 ] ++ lib.optionals (pythonOlder "3.7") [
59 # Required for rust test on x86_64-darwin
66 substituteInPlace pre_commit/resources/hook-tmpl \
67 --subst-var-by pre-commit $out
68 substituteInPlace pre_commit/languages/python.py \
69 --subst-var-by virtualenv ${virtualenv}
70 substituteInPlace pre_commit/languages/node.py \
71 --subst-var-by nodeenv ${nodeenv}
73 patchShebangs pre_commit/resources/hook-tmpl
81 export GIT_AUTHOR_NAME=test GIT_COMMITTER_NAME=test \
82 GIT_AUTHOR_EMAIL=test@example.com GIT_COMMITTER_EMAIL=test@example.com \
83 VIRTUALENV_NO_DOWNLOAD=1 PRE_COMMIT_NO_CONCURRENCY=1 LANG=en_US.UTF-8
87 export HOME=$(mktemp -d)
89 python -m venv --system-site-packages venv
90 source "$PWD/venv/bin/activate"
91 #$out/bin/pre-commit install
92 python setup.py develop
100 # ERROR: The install method you used for conda--probably either `pip install conda`
101 # or `easy_install conda`--is not compatible with using conda as an application.
105 # /build/pytest-of-nixbld/pytest-0/test_install_ruby_with_version0/rbenv-2.7.2/libexec/rbenv-init:
106 # /usr/bin/env: bad interpreter: No such file or directory
110 "test_additional_dependencies_roll_forward"
111 "test_additional_golang_dependencies_installed"
112 "test_additional_node_dependencies_installed"
113 "test_additional_rust_cli_dependencies_installed"
114 "test_additional_rust_lib_dependencies_installed"
118 "test_golang_hook_still_works_when_gobin_is_set"
119 "test_installs_without_links_outside_env"
120 "test_local_dart_additional_dependencies"
121 "test_local_golang_additional_dependencies"
122 "test_local_lua_additional_dependencies"
123 "test_local_perl_additional_dependencies"
124 "test_local_rust_additional_dependencies"
129 "test_r_local_with_additional_dependencies_hook"
130 "test_r_with_additional_dependencies_hook"
131 "test_run_a_node_hook_default_version"
132 "test_run_versioned_node_hook"
134 # python2, no explanation needed
136 "test_switch_language_versions_doesnt_clobber"
139 "test_run_a_docker_hook"
141 # i don't know why these fail
142 "test_install_existing_hooks_no_overwrite"
143 "test_installed_from_venv"
144 "test_uninstall_restores_legacy_hooks"
146 # Expects `git commit` to fail when `pre-commit` is not in the `$PATH`,
147 # but we use an absolute path so it's not an issue.
148 "test_environment_not_sourced"
150 # broken with Git 2.38.1, upstream issue filed at https://github.com/pre-commit/pre-commit/issues/2579
151 "test_golang_with_recursive_submodule"
152 "test_install_in_submodule_and_run"
153 "test_is_in_merge_conflict_submodule"
154 "test_get_conflicted_files_in_submodule"
155 "test_sub_nothing_unstaged"
156 "test_sub_something_unstaged"
158 "test_submodule_does_not_discard_changes"
159 "test_submodule_does_not_discard_changes_recurse"
162 pythonImportsCheck = [
167 description = "A framework for managing and maintaining multi-language pre-commit hooks";
168 homepage = "https://pre-commit.com/";
169 license = licenses.mit;
170 maintainers = with maintainers; [ borisbabic ];