# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { lib, stdenv, zig, zig-deps, }: let # build.zig.zon is the one place the version is written. The leading # whitespace in the pattern keeps `.minimum_zig_version` from matching. versionMatch = builtins.match ''.*[[:space:]]\.version[[:space:]]*=[[:space:]]*"([^"]+)".*'' ( builtins.readFile ./build.zig.zon ); in stdenv.mkDerivation (finalAttrs: { pname = "zig-sixel"; version = if versionMatch == null then throw "package.nix: no .version found in build.zig.zon" else builtins.head versionMatch; # Only what the build reads, so that editing the README or the workflow does # not rebuild the package. src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./build.zig ./build.zig.zon ./src ./tests ./tools ]; }; # The setup hook ships inside the compiler package; it supplies the build, # check and install phases and builds ReleaseSafe for a baseline CPU. nativeBuildInputs = [ zig ]; # --system hands Zig the dependency farm and forbids fetching outright. The # check phase assembles its own flags, so it needs the same option. zigBuildFlags = [ "--system" "${zig-deps}" ]; zigCheckFlags = finalAttrs.zigBuildFlags; # The library does no I/O, so the whole suite runs in the sandbox exactly as # it does in CI. doCheck = true; meta = { description = "Reading and writing DEC sixel graphics as z2d surfaces"; homepage = "https://git.jcollie.dev/jeff/zig-sixel"; license = lib.licenses.mit; platforms = lib.platforms.unix; }; })