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"
```
Without the change build on `master` fails as:
In file included from /build/source/components/misc/stringops.hpp:8,
from /build/source/components/settings/settings.cpp:6:
/build/source/components/misc/utf8stream.hpp:11:13: error: 'uint32_t' does not name a type
11 | typedef uint32_t UnicodeChar;
| ^~~~~~~~
/build/source/components/misc/utf8stream.hpp:5:1: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
4 | #include <cstring>
+++ |+#include <cstdint>
The OpenMW codebase already has Darwin build support within it, so porting
it over to nixpkgs was something I wanted to try out.
Issues encountered, in order:
A few dependencies in nixpkgs were missing Darwin support. Details of those
changes are in their respective commits.
After the dependencies were building, the build first failed with a missing
reference to VideoDecodeAcceleration, which was easily dealt with.
Then the build succeeded! Job's done, success! Except OpenMW.app was nowhere
to be found in the result folder. OpenMW-CS.app, however, was produced and
appeared to be running correctly (though I will admit I didn't test it very
much as I'm not very familiar).
Going through OpenMW's CMakeLists.txt showed that a CMake define was needed,
`OPENMW_OSX_DEPLOYMENT=ON`. This is what enables OpenMW.app to be built.
Once the define was added, the build began to fail with missing plugins to
OpenSceneGraph. Looking into that showed that OSG doesn't build certain plugins
on Darwin due to the fact that their functionality is replicated by built-
in system libraries. To save space, these libraries are not built on Darwin.
OpenMW, however, requires these libraries to exist. I was familiar with the
process of building OpenMW on Darwin already, due to having built it locally
ahead of time, so I remembered that the OpenMW folks have a separate repository
with Mac-specific patches. One of those patches is to OpenSceneGraph for this
exact issue, which is now applied here.
The next error was caused by `fixup_bundle` running from the OpenMW CMakeLists.txt,
which appears to be broken in Darwin under Nix. Searching nixpkgs shows that others
have worked around the issue by removing the call to `fixup_bundle` completely.
At this point, the build passed and OpenMW.app was created and was executable!
After the intro video played, it was clear that something wasn't working though.
Every texture was completely pink, navigating the main menu was impossible. Looking
at the console output showed that OpenSceneGraph was attempting to load dds
textures, but the plugin for doing so could not be loaded. I looked at the plugin
with `file` which showed the file was actually a bash script. It was setting
some QT environment variables before calling the real plugin executable. I
resolved this issue with setting `dontWrapQtApps`, as everything seems to work
without it (even the QT-based apps like the Construction Set).
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper
this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
After making `ffmpeg` point to the latest `ffmpeg_4`, all packages that
used `ffmpeg` without requiring a specific version now use ffmpeg_3
explicitly so they shouldn't change.
There ver very many conflicts, basically all due to
name -> pname+version. Fortunately, almost everything was auto-resolved
by kdiff3, and for now I just fixed up a couple evaluation problems,
as verified by the tarball job. There might be some fallback to these
conflicts, but I believe it should be minimal.
Hydra nixpkgs: ?compare=1538299