# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { lib, stdenv, callPackage, zig_0_16, }: let # Generated by zon2nix from build.zig.zon; regenerate with: # nix run github:jcollie/zon2nix#zon2nix -- --nix=build.zig.zon.nix --16 build.zig.zon zigDeps = callPackage ./build.zig.zon.nix { }; in stdenv.mkDerivation (finalAttrs: { pname = "zsmtp"; # Keep in step with `.version` in build.zig.zon. version = "0.0.0"; # Only what `zig build` actually reads. Narrowing the source this way keeps # a stray .zig-cache out of the store, and means edits to the flake, the # README or the license texts do not invalidate the derivation. src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./build.zig ./build.zig.zon ./src ]; }; # Provides the configure/build/check/install phases for a `zig build` # project, including a writable ZIG_GLOBAL_CACHE_DIR. It passes # `-Dcpu=baseline --release=safe`, so the result is a portable ReleaseSafe # binary rather than the Debug one `zig build` produces by default. nativeBuildInputs = [ zig_0_16 ]; # All Zig dependencies come from nix, so the sandboxed build never # fetches over the network. zigBuildFlags = [ "--system" "${zigDeps}" ]; zigCheckFlags = finalAttrs.zigBuildFlags; # `zig build test` is fully hermetic: scripted sessions over in-memory # readers and writers. Interoperability against real MTAs is covered by # the NixOS VM check instead. doCheck = true; meta = { description = "SMTP client and server library for Zig"; longDescription = '' zsmtp is an SMTP client and server library (RFC 5321) for Zig. Both sides run over plain std.Io.Reader/std.Io.Writer pairs, making them transport-agnostic, and support STARTTLS and implicit TLS, AUTH, streamed message bodies, and the SIZE, 8BITMIME, CHUNKING and SMTPUTF8 extensions. A small demo CLI for sending and receiving is included. ''; homepage = "https://git.jcollie.dev/jeff/zsmtp"; license = lib.licenses.mit; mainProgram = "zsmtp"; platforms = lib.platforms.unix; }; })