zig_0_10: init at 0.10.1

On Linux, upgrade Zig to version 0.10.1.

On macOS/Darwin, Zig version 0.10.1 is broken, so keep 0.9.1.

Several Zig-using packages are broken with Zig version 0.10.1, so pin
those packages to Zig version 0.9.1.
This commit is contained in:
Matthew "strager" Glazar 2023-01-11 23:10:08 -08:00
parent aea9b201cb
commit db76c9e04a
2 changed files with 99 additions and 9 deletions

View file

@ -0,0 +1,69 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, coreutils
, llvmPackages
, libxml2
, zlib
}:
stdenv.mkDerivation rec {
pname = "zig";
version = "0.10.1";
src = fetchFromGitHub {
owner = "ziglang";
repo = pname;
rev = version;
hash = "sha256-69QIkkKzApOGfrBdgtmxFMDytRkSh+0YiaJQPbXsBeo=";
};
nativeBuildInputs = [
cmake
llvmPackages.llvm.dev
];
buildInputs = [
coreutils
libxml2
zlib
] ++ (with llvmPackages; [
libclang
lld
llvm
]);
preBuild = ''
export HOME=$TMPDIR;
'';
postPatch = ''
# Zig's build looks at /usr/bin/env to find dynamic linking info. This
# doesn't work in Nix' sandbox. Use env from our coreutils instead.
substituteInPlace lib/std/zig/system/NativeTargetInfo.zig --replace "/usr/bin/env" "${coreutils}/bin/env"
'';
cmakeFlags = [
# file RPATH_CHANGE could not write new RPATH
"-DCMAKE_SKIP_BUILD_RPATH=ON"
];
doCheck = true;
installCheckPhase = ''
$out/bin/zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig
'';
meta = with lib; {
homepage = "https://ziglang.org/";
description =
"General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software";
license = licenses.mit;
maintainers = with maintainers; [ aiotter andrewrk AndersonTorres ];
platforms = platforms.unix;
# Build fails on Darwin on both AArch64 and x86_64:
# https://github.com/NixOS/nixpkgs/pull/210324#issuecomment-1381313616
# https://github.com/NixOS/nixpkgs/pull/210324#issuecomment-1381236045
broken = stdenv.isDarwin;
};
}

View file

@ -5355,9 +5355,13 @@ with pkgs;
rex = callPackage ../tools/system/rex { };
river = callPackage ../applications/window-managers/river { };
river = callPackage ../applications/window-managers/river {
zig = zig_0_9;
};
rivercarro = callPackage ../applications/misc/rivercarro { };
rivercarro = callPackage ../applications/misc/rivercarro {
zig = zig_0_9;
};
rmapi = callPackage ../applications/misc/remarkable/rmapi { };
@ -7201,7 +7205,9 @@ with pkgs;
findutils = callPackage ../tools/misc/findutils { };
findup = callPackage ../tools/misc/findup { };
findup = callPackage ../tools/misc/findup {
zig = zig_0_9;
};
bsd-finger = callPackage ../tools/networking/bsd-finger { };
bsd-fingerd = bsd-finger.override({ buildClient = false; });
@ -18732,7 +18738,9 @@ with pkgs;
ytt = callPackage ../development/tools/ytt {};
zls = callPackage ../development/tools/zls { };
zls = callPackage ../development/tools/zls {
zig = zig_0_9;
};
zydis = callPackage ../development/libraries/zydis { };
@ -23745,7 +23753,12 @@ with pkgs;
zig_0_9 = darwin.apple_sdk_11_0.callPackage ../development/compilers/zig/0.9.1.nix {
llvmPackages = llvmPackages_13;
};
zig = zig_0_9;
# requires a newer Apple SDK
zig_0_10 = darwin.apple_sdk_11_0.callPackage ../development/compilers/zig/0.10.nix {
llvmPackages = llvmPackages_15;
};
# Zig 0.10.1 is broken on Darwin, so use 0.9.1 on Darwin instead.
zig = if stdenv.isDarwin then zig_0_9 else zig_0_10;
zimlib = callPackage ../development/libraries/zimlib { };
@ -30078,7 +30091,9 @@ with pkgs;
waybar = callPackage ../applications/misc/waybar {};
waylock = callPackage ../applications/misc/waylock {};
waylock = callPackage ../applications/misc/waylock {
zig = zig_0_9;
};
wayshot = callPackage ../tools/misc/wayshot { };
@ -30995,7 +31010,9 @@ with pkgs;
merkaartor = libsForQt5.callPackage ../applications/misc/merkaartor { };
mepo = callPackage ../applications/misc/mepo { };
mepo = callPackage ../applications/misc/mepo {
zig = zig_0_9;
};
meshcentral = callPackage ../tools/admin/meshcentral { };
@ -31635,7 +31652,9 @@ with pkgs;
netcoredbg = callPackage ../development/tools/misc/netcoredbg { };
ncdu = callPackage ../tools/misc/ncdu { };
ncdu = callPackage ../tools/misc/ncdu {
zig = zig_0_9;
};
ncdu_1 = callPackage ../tools/misc/ncdu/1.nix { };
ncdc = callPackage ../applications/networking/p2p/ncdc { };
@ -34656,7 +34675,9 @@ with pkgs;
inherit (perlPackages) PathTiny;
};
blackshades = callPackage ../games/blackshades { };
blackshades = callPackage ../games/blackshades {
zig = zig_0_9;
};
blobby = callPackage ../games/blobby { };