Something went wrong. Try again.
A sans-I/O Zig library that reads and writes DEC sixel graphics as z2d surfaces.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
{ description = "zig-sixel - reading and writing DEC sixel graphics as z2d surfaces";
inputs = { nixpkgs = { url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"; }; # The toolchain is the official 0.17.0 release binary, packaged by the # overlay, rather than nixpkgs' Zig, which has no 0.17 yet. zig = { url = "git+https://git.jcollie.dev/jeff/zig-overlay.git"; inputs = { nixpkgs.follows = "nixpkgs"; zon2nix.follows = "zon2nix"; }; }; # Reads `build.zig.zon`, follows every transitive dependency, and writes a # Nix expression for the lot, so that a Nix build fetches nothing itself. # Not the `zon2nix` in nixpkgs, which is a different program. zon2nix = { url = "github:jcollie/zon2nix"; inputs = { nixpkgs.follows = "nixpkgs"; zig.follows = "zig"; }; }; };
outputs = { self, nixpkgs, zig, zon2nix, ... }:
let inherit (nixpkgs) lib; makePackages = system: import nixpkgs { inherit system; }; forAllSystems = lib.genAttrs lib.systems.flakeExposed; zigFor = system: zig.packages.${system}."0.17.0"; in { packages = forAllSystems ( system: let pkgs = makePackages system; # Generated from build.zig.zon; regenerate with # # nix develop -c zon2nix --17 --nix=build.zig.zon.nix build.zig.zon # # The expression asks for `zig_0_17`, which nixpkgs does not have, # so it is handed the overlay's. zig-deps = pkgs.callPackage ./build.zig.zon.nix { zig_0_17 = zigFor system; }; zig-sixel = pkgs.callPackage ./package.nix { zig = zigFor system; inherit zig-deps; }; in { inherit zig-deps zig-sixel; default = zig-sixel; } );
checks = forAllSystems (system: { inherit (self.packages.${system}) zig-sixel; });
devShells = forAllSystems ( system: let pkgs = makePackages system; in { default = pkgs.mkShell { name = "zig-sixel"; nativeBuildInputs = [ (zigFor system) # Publishes the API documentation to jcollie.page; see # .forgejo/workflows/test.yaml. pkgs.git-pages-cli # Checks the SPDX headers; see REUSE.toml. pkgs.reuse # Writes build.zig.zon.nix. Wrapped so that the Zig it shells # out to for `zig env` is this one: without a Zig on PATH it # stops having written nothing, which leaves the old file # looking untouched. (pkgs.symlinkJoin { name = "zon2nix"; paths = [ zon2nix.packages.${pkgs.stdenv.hostPlatform.system}.zon2nix ]; nativeBuildInputs = [ pkgs.makeWrapper ]; postBuild = '' wrapProgram $out/bin/zon2nix \ --prefix PATH : ${lib.makeBinPath [ (zigFor system) ]} ''; }) # libsixel is the oracle: `img2sixel` writes the reference # fixtures in tests/fixtures and `sixel2png` decodes what the # encoder here writes. Pillow reads the PNGs back into pixels. # See tools/oracle.py. pkgs.libsixel (pkgs.python3.withPackages (ps: [ ps.pillow ])) ] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [ pkgs.kcov ]; }; } ); };}