A maildir and Maildir++ library for Zig 0.16: delivery, flags, folders and quota.
1.8 kB
61 lines
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 # Generated from build.zig.zon by zon2nix; regenerate with
12 # nix develop -c zon2nix --16 --nix=build.zig.zon.nix build.zig.zon
13 zigDeps = callPackage ./build.zig.zon.nix { };
14in
15stdenv.mkDerivation (finalAttrs: {
16 pname = "zig-maildir";
17 version = "0.0.0";
18
19 # Named rather than filtered, so that editing something outside this list --
20 # the flake, a scratch file, the NixOS tests that consume the result -- does
21 # not rebuild the package and, in the tests, the whole virtual machine.
22 src = lib.fileset.toSource {
23 root = ./.;
24 fileset = lib.fileset.unions [
25 ./build.zig
26 ./build.zig.zon
27 ./build.zig.zon.nix
28 ./src
29 ./tests
30 ./tools
31 ./LICENSES
32 ./README.md
33 ./REUSE.toml
34 ];
35 };
36
37 nativeBuildInputs = [ zig_0_16.hook ];
38
39 # `--system` does not merely offer the directory, it forbids fetching: a
40 # dependency missing from it is a build error naming the package rather than
41 # a silent attempt to reach a network the sandbox does not have.
42 zigBuildFlags = [
43 "--system"
44 "${zigDeps}"
45 ];
46 # The check phase assembles its own flags rather than reusing the build's,
47 # so without this `zig build test` runs without --system and tries to fetch.
48 zigCheckFlags = finalAttrs.zigBuildFlags;
49
50 # The end-to-end tests want a directory to make a maildir in, which the
51 # build sandbox has; nothing here needs a network or a second process.
52 doCheck = true;
53
54 meta = {
55 description = "A maildir and Maildir++ library for Zig";
56 homepage = "https://git.jcollie.dev/jeff/zig-maildir";
57 license = lib.licenses.mit;
58 mainProgram = "zig-maildir";
59 platforms = lib.platforms.unix;
60 };
61})