Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig: 0.9.1 -> 0.10.1 #210324

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions pkgs/development/compilers/zig/0.10.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
40 changes: 31 additions & 9 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };

Expand Down Expand Up @@ -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; });
Expand Down Expand Up @@ -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 { };

Expand Down Expand Up @@ -23742,9 +23750,15 @@ with pkgs;
libzra = callPackage ../development/libraries/libzra { };

# 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;
};
# 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 { };

Expand Down Expand Up @@ -30077,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 { };

Expand Down Expand Up @@ -30994,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 { };

Expand Down Expand Up @@ -31634,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 { };
Expand Down Expand Up @@ -34655,7 +34675,9 @@ with pkgs;
inherit (perlPackages) PathTiny;
};

blackshades = callPackage ../games/blackshades { };
blackshades = callPackage ../games/blackshades {
zig = zig_0_9;
};

blobby = callPackage ../games/blobby { };

Expand Down