# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { lib, stdenv, callPackage, zig_0_17, }: let # Generated by zon2nix from build.zig.zon; regenerate with: # nix develop -c zon2nix --17 --nix=build.zig.zon.nix build.zig.zon zigDeps = callPackage ./build.zig.zon.nix { }; in stdenv.mkDerivation (finalAttrs: { pname = "zig-dmarc"; # Keep in step with `.version` in build.zig.zon. version = "0.2.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 ./tools ]; }; nativeBuildInputs = [ zig_0_17 ]; # All Zig dependencies come from nix, so the sandboxed build never # fetches over the network. zigBuildFlags = [ "--system" "${zigDeps}" ]; # The check phase assembles its own flags rather than reusing the # build's, so without this `zig build test` runs without --system, # tries to fetch, and fails in the sandbox. zigCheckFlags = finalAttrs.zigBuildFlags; # The tests are hermetic: parsers over bytes, and an evaluator that # reads a table rather than a nameserver. doCheck = true; # For the flake's `zig-deps` output, so that it is the same set this # package builds with. passthru = { inherit zigDeps; }; meta = { description = "DMARC (RFC 7489) for Zig"; longDescription = '' zig-dmarc implements RFC 7489: the record grammar, identifier alignment against SPF and DKIM results, and policy discovery. It consumes authentication results rather than producing them, and takes its DNS resolver as a parameter. ''; homepage = "https://git.jcollie.dev/jeff/zig-dmarc"; license = lib.licenses.mit; mainProgram = "dmarc"; platforms = lib.platforms.unix; }; })