zig_0_9: refactor

- Move zig_0_10_0 to prePatch
- Use rec-less, overlay-style overridable recursive attributes (in effect since
NixOS#119942);
- Add meta.changelog
This commit is contained in:
Anderson Torres 2023-07-07 19:46:53 -03:00
parent 69900c5838
commit cc08d73612

View file

@ -7,22 +7,14 @@
, zlib , zlib
}: }:
let stdenv.mkDerivation (finalAttrs: {
zig_0_10_0 = fetchFromGitHub {
owner = "ziglang";
repo = "zig";
rev = "0.10.0";
hash = "sha256-DNs937N7PLQimuM2anya4npYXcj6cyH+dRS7AiOX7tw=";
};
in
stdenv.mkDerivation rec {
pname = "zig"; pname = "zig";
version = "0.9.1"; version = "0.9.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ziglang"; owner = "ziglang";
repo = pname; repo = "zig";
rev = version; rev = finalAttrs.version;
hash = "sha256-x2c4c9RSrNWGqEngio4ArW7dJjW0gg+8nqBwPcR721k="; hash = "sha256-x2c4c9RSrNWGqEngio4ArW7dJjW0gg+8nqBwPcR721k=";
}; };
@ -34,7 +26,14 @@ stdenv.mkDerivation rec {
]; ];
# TODO: remove on next upgrade # TODO: remove on next upgrade
prePatch = '' prePatch = let
zig_0_10_0 = fetchFromGitHub {
owner = "ziglang";
repo = "zig";
rev = "0.10.0";
hash = "sha256-DNs937N7PLQimuM2anya4npYXcj6cyH+dRS7AiOX7tw=";
};
in ''
cp -R ${zig_0_10_0}/lib/libc/include/any-macos.13-any lib/libc/include/any-macos.13-any cp -R ${zig_0_10_0}/lib/libc/include/any-macos.13-any lib/libc/include/any-macos.13-any
cp -R ${zig_0_10_0}/lib/libc/include/aarch64-macos.13-none lib/libc/include/aarch64-macos.13-gnu cp -R ${zig_0_10_0}/lib/libc/include/aarch64-macos.13-none lib/libc/include/aarch64-macos.13-gnu
cp -R ${zig_0_10_0}/lib/libc/include/x86_64-macos.13-none lib/libc/include/x86_64-macos.13-gnu cp -R ${zig_0_10_0}/lib/libc/include/x86_64-macos.13-none lib/libc/include/x86_64-macos.13-gnu
@ -68,18 +67,20 @@ stdenv.mkDerivation rec {
]; ];
doCheck = true; doCheck = true;
checkPhase = '' checkPhase = ''
runHook preCheck runHook preCheck
./zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig ./zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig
runHook postCheck runHook postCheck
''; '';
meta = with lib; { meta = {
homepage = "https://ziglang.org/"; homepage = "https://ziglang.org/";
description = description =
"General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software"; "General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ aiotter andrewrk AndersonTorres ]; changelog = "https://ziglang.org/download/${finalAttrs.version}/release-notes.html";
platforms = platforms.unix; maintainers = with lib.maintainers; [ aiotter andrewrk AndersonTorres ];
platforms = lib.platforms.unix;
}; };
} })