After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
- `env.ZIG_GLOBAL_CACHE_DIR` does not resolve variables, so
all actions had their cache dir in the current directory, named
'$TMPDIR/zig-cache'.
- zig cache does not conflict, so it's totally fine to reuse it in both
build and tests (thus removing `--cache-dir`).
While we're at this, fix a `substituteInPlace` deprecation warning.
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"
```
During stage 3 of compilation, Zig calls `std.zig.system.darwin.macos.detect`,
which parses /System/Library/CoreServices/.SystemVersionPlatform.plist and
/System/Library/CoreServices/SystemVersion.plist[^1] to determine the OS
version. These paths are inaccessible when the sandbox is enabled, which causes
the build to fail with `OSVersionDetectionFail`[^2]. Fix the build with the
relaxed sandbox option by adding these paths to `__impureHostDeps`.
[^1]: cd62005f19/lib/std/zig/system/darwin/macos.zig
[^2]: https://github.com/NixOS/nixpkgs/issues/287861#issuecomment-2148703491
- migrate it to a dedicated directory, zig/0.12
- can't migrate to by-name
- because of undecipherable darwin.apple_sdk_11_0.callPackage
- nixfmt
- add a simple version test
- migrate it to a dedicated directory, zig/0.11
- can't migrate to by-name
- because of undecipherable darwin.apple_sdk_11_0.callPackage
- nixfmt
- add a simple version test
- migrate it to a dedicated directory, zig/0.10
- can't migrate to by-name
- because of undecipherable darwin.apple_sdk_11_0.callPackage
- nixfmt
- add a simple version test
- migrate it to a dedicated directory, zig/0.9
- can't migrate to by-name
- because of undecipherable darwin.apple_sdk_11_0.callPackage
- nixfmt
- add a simple version test
- Use rec-less, overlay-style overridable recursive attributes (in effect since
NixOS#119942);
- Add decoration hooks over installCheckPhase
- Use doInstallCheck instead of doCheck.
- Directly sets env.ZIG_GLOBAL_CACHE_DIR instead of using preBuild
- Add meta.changelog
Relevant upstream issue: ziglang/zig#14559
The patch is a backport of fixes that landed in zig-master and can
be removed with zig-0.11 release.
Additionally, make sure we link statically against LLVM to avoid
unpleasant runtime surprises originating from mixing static and
dynamic LLVM libraries.
Finally, unbreak Zig 0.10.1 on macOS.