# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { lib, stdenv, callPackage, 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-wuffs"; version = "0.2.0"; # Named rather than `./.`, so that editing the README or the workflow does # not rebuild WUFFS. tools/ is in the list because build.zig reads # tools/freestanding.zig, and include/ because the C cannot be translated # without it on a target with no libc. src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./build.zig ./build.zig.zon ./include ./src ./tools ]; }; nativeBuildInputs = [ zig_0_17 ]; # `--system` does not merely offer the directory, it forbids fetching: a # dependency missing from it is a build error naming the package rather # than a silent attempt to reach the network. 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 decode in-memory fixtures and talk to nothing, so they run # here. doCheck = true; meta = { description = "Zig bindings to Google's WUFFS image decoders for PNG, JPEG, GIF and Netpbm"; homepage = "https://git.jcollie.dev/jeff/zig-wuffs"; license = lib.licenses.mit; platforms = lib.platforms.all; }; })