An SMTP client and server library for Zig implementing RFC 5321.
1# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>
2# SPDX-License-Identifier: MIT
3
4{
5 lib,
6 stdenv,
7 callPackage,
8 zig_0_16,
9}:
10let
11 zigDeps = callPackage ./zig-deps.nix { };
12in
13stdenv.mkDerivation {
14 pname = "zsmtp";
15 version = "0.0.0";
16
17 src = lib.cleanSource ../.;
18
19 nativeBuildInputs = [ zig_0_16 ];
20
21 # Provide the dependency offline through the project-local package
22 # directory, which the build consults before fetching.
23 postPatch = ''
24 mkdir -p zig-pkg
25 cp -r ${zigDeps}/* zig-pkg/
26 '';
27
28 dontConfigure = true;
29
30 buildPhase = ''
31 runHook preBuild
32 export ZIG_GLOBAL_CACHE_DIR=$TMPDIR/zig-global-cache
33 zig build install -Doptimize=ReleaseSafe --prefix $out
34 runHook postBuild
35 '';
36
37 doCheck = true;
38 checkPhase = ''
39 runHook preCheck
40 zig build test
41 runHook postCheck
42 '';
43
44 dontInstall = true;
45
46 meta = {
47 description = "SMTP client and server library for Zig";
48 license = lib.licenses.mit;
49 mainProgram = "zsmtp";
50 };
51}