# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { description = "Sender Policy Framework (RFC 7208) for Zig"; inputs = { nixpkgs = { url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"; }; # Not the zon2nix in nixpkgs, which is a different program with # different options. zon2nix = { url = "github:jcollie/zon2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, zon2nix, ... }: let inherit (nixpkgs) lib; makePackages = system: import nixpkgs { inherit system; }; forAllSystems = lib.genAttrs lib.systems.flakeExposed; in { packages = forAllSystems ( system: let pkgs = makePackages system; in rec { zig-spf = pkgs.callPackage ./package.nix { }; default = zig-spf; # The Zig dependencies on their own, so that a job building # something other than the package -- the documentation -- # can hand them to Zig without building the package to get # them. zig-deps = pkgs.callPackage ./build.zig.zon.nix { }; } ); checks = forAllSystems ( system: let pkgs = makePackages system; in { zig-spf = pkgs.callPackage ./package.nix { }; # The openspf.org conformance suite, in the sandbox. It is a # table of zone data and expected results, so it needs no # network and no nameserver -- which is the whole reason the # evaluator takes its resolver as a parameter. conformance = pkgs.callPackage ./package.nix { withConformance = true; }; } ); devShells = forAllSystems ( system: let pkgs = makePackages system; in { default = pkgs.mkShell { name = "zig-spf"; nativeBuildInputs = [ pkgs.git-pages-cli pkgs.reuse pkgs.zig_0_17 # It shells out to `zig env`, and silently writes nothing # if it cannot find one -- which leaves the previous # build.zig.zon.nix in place looking untouched rather than # obviously broken. Wrapped so the Zig it finds is this # project's rather than whatever the caller happens to # have. (pkgs.symlinkJoin { name = "zon2nix"; paths = [ zon2nix.packages.${pkgs.stdenv.hostPlatform.system}.zon2nix ]; nativeBuildInputs = [ pkgs.makeWrapper ]; postBuild = '' wrapProgram $out/bin/zon2nix \ --prefix PATH : ${lib.makeBinPath [ pkgs.zig_0_17 ]} ''; }) ]; }; } ); }; }