Merge pull request #210324 from strager/zig-0.10.0

zig: 0.9.1 -> 0.10.1
This commit is contained in:
Weijia Wang 2023-02-01 01:42:24 +01:00 committed by GitHub
commit 70a2347ac0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 100 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

@ -5406,9 +5406,13 @@ with pkgs;
rex = callPackage ../tools/system/rex { }; 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 { }; rmapi = callPackage ../applications/misc/remarkable/rmapi { };
@ -7254,7 +7258,9 @@ with pkgs;
findutils = callPackage ../tools/misc/findutils { }; 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-finger = callPackage ../tools/networking/bsd-finger { };
bsd-fingerd = bsd-finger.override({ buildClient = false; }); bsd-fingerd = bsd-finger.override({ buildClient = false; });
@ -18814,7 +18820,9 @@ with pkgs;
ytt = callPackage ../development/tools/ytt {}; ytt = callPackage ../development/tools/ytt {};
zls = callPackage ../development/tools/zls { }; zls = callPackage ../development/tools/zls {
zig = zig_0_9;
};
zydis = callPackage ../development/libraries/zydis { }; zydis = callPackage ../development/libraries/zydis { };
@ -23833,9 +23841,15 @@ with pkgs;
libzra = callPackage ../development/libraries/libzra { }; libzra = callPackage ../development/libraries/libzra { };
# requires a newer Apple SDK # requires a newer Apple SDK
zig = darwin.apple_sdk_11_0.callPackage ../development/compilers/zig { zig_0_9 = darwin.apple_sdk_11_0.callPackage ../development/compilers/zig/0.9.1.nix {
llvmPackages = llvmPackages_13; llvmPackages = llvmPackages_13;
}; };
# 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 { }; zimlib = callPackage ../development/libraries/zimlib { };
@ -30187,7 +30201,9 @@ with pkgs;
waybar = callPackage ../applications/misc/waybar {}; waybar = callPackage ../applications/misc/waybar {};
waylock = callPackage ../applications/misc/waylock {}; waylock = callPackage ../applications/misc/waylock {
zig = zig_0_9;
};
wayshot = callPackage ../tools/misc/wayshot { }; wayshot = callPackage ../tools/misc/wayshot { };
@ -31104,7 +31120,9 @@ with pkgs;
merkaartor = libsForQt5.callPackage ../applications/misc/merkaartor { }; 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 { }; meshcentral = callPackage ../tools/admin/meshcentral { };
@ -31743,7 +31761,9 @@ with pkgs;
netcoredbg = callPackage ../development/tools/misc/netcoredbg { }; 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 { }; ncdu_1 = callPackage ../tools/misc/ncdu/1.nix { };
ncdc = callPackage ../applications/networking/p2p/ncdc { }; ncdc = callPackage ../applications/networking/p2p/ncdc { };
@ -34768,7 +34788,9 @@ with pkgs;
inherit (perlPackages) PathTiny; inherit (perlPackages) PathTiny;
}; };
blackshades = callPackage ../games/blackshades { }; blackshades = callPackage ../games/blackshades {
zig = zig_0_9;
};
blobby = callPackage ../games/blobby { }; blobby = callPackage ../games/blobby { };