We are migrating packages that meet below requirements:
1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration
The tool is here: https://github.com/Aleksanaa/by-name-migrate.
With this workaround enabled, CMake looks for SDK headers and libraries
in `${SDKROOT}/var/empty`, which ensures it will not find them.
Disabling the workaround in just this case allows CMake’s SDK support to
work with the SDKs in nixpkgs while still not including other, impure
paths in its search paths.
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"
```
patch cmake to implement a NIXPKGS_CMAKE_PREFIX_PATH env variable which
is similar to CMAKE_PREFIX_PATH except it is not searched for programs.
This is required because cmake will search CMAKE_PREFIX_PATH for
programs before PATH which is problematic as that means buildInputs gets
searched before nativeBuildInputs which can break things when the
binaries in PATH are covered or the order re-arranged.
This commit adds the -type f filter to the find command. Previously, -type f
only applied to the first file name: *.cmake. The -o command means that -type f
has to be added back for the other file names.
When cross-compiling cmake, for example with
`nix build .#pkgsCross.mipsel-linux-gnu.cmake`, the `configure`
script will invoke the build platform cmake to build the
host platform cmake. Usually, stdenv will automatically pass
variables such as `-DCMAKE_SYSTEM_PROCESSOR` to cmake
(https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/make-derivation.nix#L416),
but since here cmake is invoked 'indirectly' we have to pass
these parameters to the `configure` script ourselves.
It appears this was (surprisingly) not necessary on versions
through 3.26.4, but the update to 3.27.7 exposed that these
flags were missing, causing link failures.
Fixes#284734