In preparation for the deprecation of `stdenv.isX`.
These shorthands are not conducive to cross-compilation because they
hide the platforms.
Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way
One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059
There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.
```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
checkInputs used to be added to nativeBuildInputs. Now we have
nativeCheckInputs to do that instead. Doing this treewide change allows
to keep hashes identical to before the introduction of
nativeCheckInputs.
This changes the generated Git hook to refer to the `pre-commit` binary
by its absolute path. This means that Git hooks created with
`nix-shell --run 'pre-commit install'` or similar will be usable outside
of the Nix shell they were created in.
I think this is the intended behavior for this package, considering that
the `postPatch` phase already includes a substitution for this variable,
otherwise unused:
substituteInPlace pre_commit/resources/hook-tmpl \
--subst-var-by pre-commit $out
Including the pytest-xdist package automatically configures numprocesses
to $NIX_BUILD_CORES, so specifying these on a package level has become
redundant.
Note: not a checkInput, because we need
this dependency in the role of a _build_
input during tests: library path, etc.
Solves
E = note: ld: library not found for -liconv
E clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
E
E
E error: failed to compile `rust-hello-world v0.1.0 (/private/tmp/nix-build-python3.9-pre-commit-2.18.1.drv-1/pytest-of-nixbld4/pytest-0/popen-gw3/test_rust_hook0/0/.pre-commit/repomj5itq00)`, intermediate artifacts can be found at `/private/tmp/nix-build-python3.9-pre-commit-2.18.1.drv-1/pytest-of-nixbld4/pytest-0/popen-gw3/test_rust_hook0/0/.pre-commit/repomj5itq00/target`
E
E Caused by:
E could not compile `rust-hello-world` due to previous error
pre_commit/util.py:146: CalledProcessError
in test case
FAILED tests/repository_test.py::test_rust_hook