1616} :
1717
1818with python3Packages ;
19+ let
20+ i686Linux = stdenv . buildPlatform . system == "i686-linux" ;
21+ in
1922buildPythonApplication rec {
2023 pname = "pre-commit" ;
2124 version = "4.0.1" ;
@@ -45,26 +48,35 @@ buildPythonApplication rec {
4548 virtualenv
4649 ] ;
4750
48- nativeCheckInputs = [
49- cargo
50- coursier
51- dotnet-sdk
52- gitMinimal
53- glibcLocales
54- go
55- libiconv # For rust tests on Darwin
56- nodejs
57- perl
58- pytest-env
59- pytest-forked
60- pytest-xdist
61- pytestCheckHook
62- re-assert
63- cabal-install
64- ] ;
65-
66- # i686-linux: dotnet-sdk not available
67- doCheck = stdenv . buildPlatform . system != "i686-linux" ;
51+ nativeCheckInputs =
52+ [
53+ cargo
54+ gitMinimal
55+ glibcLocales
56+ go
57+ libiconv # For rust tests on Darwin
58+ perl
59+ pytest-env
60+ pytest-forked
61+ pytest-xdist
62+ pytestCheckHook
63+ re-assert
64+ cabal-install
65+ ]
66+ ++ lib . optionals ( ! i686Linux ) [
67+ # coursier can be moved back to the main nativeCheckInputs list once we’re able to bootstrap a
68+ # JRE on i686-linux: <https://github.com/NixOS/nixpkgs/issues/314873>. When coursier gets
69+ # moved back to the main nativeCheckInputs list, don’t forget to re-enable the
70+ # coursier-related test that is currently disabled on i686-linux.
71+ coursier
72+ # i686-linux: dotnet-sdk not available
73+ dotnet-sdk
74+ # nodejs can be moved back to the main nativeCheckInputs list once this
75+ # issue is fixed: <https://github.com/NixOS/nixpkgs/issues/387658>. When nodejs gets
76+ # moved back to the main nativeCheckInputs list, don’t forget to re-enable the
77+ # Node.js-related tests that are currently disabled on i686-linux.
78+ nodejs
79+ ] ;
6880
6981 postPatch = ''
7082 substituteInPlace pre_commit/resources/hook-tmpl \
@@ -90,10 +102,12 @@ buildPythonApplication rec {
90102 export GIT_AUTHOR_NAME=test GIT_COMMITTER_NAME=test \
9110392104 VIRTUALENV_NO_DOWNLOAD=1 PRE_COMMIT_NO_CONCURRENCY=1 LANG=en_US.UTF-8
93-
105+ ''
106+ + lib . optionalString ( ! i686Linux ) ''
94107 # Resolve `.NET location: Not found` errors for dotnet tests
95108 export DOTNET_ROOT="${ dotnet-sdk } /share/dotnet"
96-
109+ ''
110+ + ''
97111 export HOME=$(mktemp -d)
98112
99113 git init -b master
@@ -106,70 +120,80 @@ buildPythonApplication rec {
106120 deactivate
107121 '' ;
108122
109- disabledTests = [
110- # ERROR: The install method you used for conda--probably either `pip install conda`
111- # or `easy_install conda`--is not compatible with using conda as an application.
112- "test_conda_"
113- "test_local_conda_"
114-
115- # /build/pytest-of-nixbld/pytest-0/test_install_ruby_with_version0/rbenv-2.7.2/libexec/rbenv-init:
116- # /usr/bin/env: bad interpreter: No such file or directory
117- "test_ruby_"
118-
119- # network
120- "test_additional_dependencies_roll_forward"
121- "test_additional_golang_dependencies_installed"
122- "test_additional_node_dependencies_installed"
123- "test_additional_rust_cli_dependencies_installed"
124- "test_additional_rust_lib_dependencies_installed"
125- "test_coursier_hook"
126- "test_coursier_hook_additional_dependencies"
127- "test_dart"
128- "test_dart_additional_deps"
129- "test_dart_additional_deps_versioned"
130- "test_during_commit_all"
131- "test_golang_default_version"
132- "test_golang_hook"
133- "test_golang_hook_still_works_when_gobin_is_set"
134- "test_golang_infer_go_version_default"
135- "test_golang_system"
136- "test_golang_versioned"
137- "test_language_version_with_rustup"
138- "test_installs_rust_missing_rustup"
139- "test_installs_without_links_outside_env"
140- "test_local_golang_additional_deps"
141- "test_lua"
142- "test_lua_additional_dependencies"
143- "test_node_additional_deps"
144- "test_node_hook_versions"
145- "test_perl_additional_dependencies"
146- "test_r_hook"
147- "test_r_inline"
148- "test_r_inline_hook"
149- "test_r_local_with_additional_dependencies_hook"
150- "test_r_with_additional_dependencies_hook"
151- "test_run_a_node_hook_default_version"
152- "test_run_lib_additional_dependencies"
153- "test_run_versioned_node_hook"
154- "test_rust_cli_additional_dependencies"
155- "test_swift_language"
156- "test_run_example_executable"
157- "test_run_dep"
158-
159- # i don't know why these fail
160- "test_install_existing_hooks_no_overwrite"
161- "test_installed_from_venv"
162- "test_uninstall_restores_legacy_hooks"
163- "test_dotnet_"
164- "test_health_check_"
165-
166- # Expects `git commit` to fail when `pre-commit` is not in the `$PATH`,
167- # but we use an absolute path so it's not an issue.
168- "test_environment_not_sourced"
169-
170- # Docker required
171- "test_docker_"
172- ] ;
123+ disabledTests =
124+ [
125+ # ERROR: The install method you used for conda--probably either `pip install conda`
126+ # or `easy_install conda`--is not compatible with using conda as an application.
127+ "test_conda_"
128+ "test_local_conda_"
129+
130+ # /build/pytest-of-nixbld/pytest-0/test_install_ruby_with_version0/rbenv-2.7.2/libexec/rbenv-init:
131+ # /usr/bin/env: bad interpreter: No such file or directory
132+ "test_ruby_"
133+
134+ # network
135+ "test_additional_dependencies_roll_forward"
136+ "test_additional_golang_dependencies_installed"
137+ "test_additional_node_dependencies_installed"
138+ "test_additional_rust_cli_dependencies_installed"
139+ "test_additional_rust_lib_dependencies_installed"
140+ "test_coursier_hook"
141+ "test_coursier_hook_additional_dependencies"
142+ "test_dart"
143+ "test_dart_additional_deps"
144+ "test_dart_additional_deps_versioned"
145+ "test_during_commit_all"
146+ "test_golang_default_version"
147+ "test_golang_hook"
148+ "test_golang_hook_still_works_when_gobin_is_set"
149+ "test_golang_infer_go_version_default"
150+ "test_golang_system"
151+ "test_golang_versioned"
152+ "test_language_version_with_rustup"
153+ "test_installs_rust_missing_rustup"
154+ "test_installs_without_links_outside_env"
155+ "test_local_golang_additional_deps"
156+ "test_lua"
157+ "test_lua_additional_dependencies"
158+ "test_node_additional_deps"
159+ "test_node_hook_versions"
160+ "test_perl_additional_dependencies"
161+ "test_r_hook"
162+ "test_r_inline"
163+ "test_r_inline_hook"
164+ "test_r_local_with_additional_dependencies_hook"
165+ "test_r_with_additional_dependencies_hook"
166+ "test_run_a_node_hook_default_version"
167+ "test_run_lib_additional_dependencies"
168+ "test_run_versioned_node_hook"
169+ "test_rust_cli_additional_dependencies"
170+ "test_swift_language"
171+ "test_run_example_executable"
172+ "test_run_dep"
173+
174+ # i don't know why these fail
175+ "test_install_existing_hooks_no_overwrite"
176+ "test_installed_from_venv"
177+ "test_uninstall_restores_legacy_hooks"
178+ "test_dotnet_"
179+ "test_health_check_"
180+
181+ # Expects `git commit` to fail when `pre-commit` is not in the `$PATH`,
182+ # but we use an absolute path so it's not an issue.
183+ "test_environment_not_sourced"
184+
185+ # Docker required
186+ "test_docker_"
187+ ]
188+ ++ lib . optionals i686Linux [
189+ # From coursier_test.py:
190+ "test_error_if_no_deps_or_channel"
191+ # From node_test.py:
192+ "test_healthy_system_node"
193+ "test_unhealthy_if_system_node_goes_missing"
194+ "test_node_hook_system"
195+ "test_node_with_user_config_set"
196+ ] ;
173197
174198 pythonImportsCheck = [
175199 "pre_commit"
0 commit comments