# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { lib, stdenv, callPackage, zig_0_16, }: let # Generated from build.zig.zon by zon2nix; regenerate with # nix develop -c zon2nix --16 --nix=build.zig.zon.nix build.zig.zon zigDeps = callPackage ./build.zig.zon.nix { }; in stdenv.mkDerivation (finalAttrs: { pname = "zig-expect"; version = "0.0.0"; # Named rather than filtered, so that editing the flake, the workflow or # the README does not rebuild the package. src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./build.zig ./build.zig.zon ./examples ./src ./tools ]; }; nativeBuildInputs = [ zig_0_16 ]; zigBuildFlags = [ "--system" "${zigDeps}" ]; # The check phase assembles its own flags rather than reusing the build's, # so without this `zig build test` runs without --system, tries to fetch, # and fails in the sandbox. zigCheckFlags = finalAttrs.zigBuildFlags; # The tests spawn real children on real pseudo-terminals, which the build # sandbox provides: it mounts a private /dev/pts. doCheck = true; meta = { description = "A Zig library for driving interactive programs, in the manner of expect"; homepage = "https://git.jcollie.dev/jeff/zig-expect"; license = lib.licenses.mit; mainProgram = "python-calculator"; platforms = lib.platforms.unix ++ lib.platforms.windows; }; })