# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { lib, stdenv, callPackage, git, tzdata, zig_0_17, }: let # Generated from build.zig.zon by zon2nix; regenerate with # nix develop -c zon2nix --17 --nix=build.zig.zon.nix build.zig.zon zigDeps = callPackage ./build.zig.zon.nix { }; in stdenv.mkDerivation (finalAttrs: { pname = "zig-git"; version = "0.1.0"; # Named rather than filtered, so that editing something outside this list # -- the flake, the workflow, a scratch file -- does not rebuild the package. src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./build.zig ./build.zig.zon ./src ./tools ./LICENSES ./REUSE.toml ]; }; nativeBuildInputs = [ zig_0_17.hook ]; # --system forbids fetching: every dependency comes from zigDeps. zigBuildFlags = [ "--system" "${zigDeps}" ]; # The check phase assembles its own flags rather than reusing the # build's, so without this `zig build test` tries to fetch and fails in # the sandbox. zigCheckFlags = finalAttrs.zigBuildFlags; # The tests make their repositories with git and compare answers with it. nativeCheckInputs = [ git ]; doCheck = true; # The time zones the tests that compare dates read local time with. preCheck = '' export TZDIR=${tzdata}/share/zoneinfo ''; # The install phase installs zig-git, the tool for comparing the library # with git; the library itself has nothing to install but its # documentation. postInstall = '' zig build docs --system ${zigDeps} --prefix $out ''; meta = { description = "Reading and writing git repositories in Zig, without running git"; homepage = "https://git.jcollie.dev/jeff/zig-git"; license = lib.licenses.mit; platforms = lib.platforms.unix; }; })