# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie # SPDX-License-Identifier: MIT { lib, stdenv, callPackage, zig_0_16, }: let # Generated from build.zig.zon by zon2nix; regenerate with # nix develop -c zon2nix --16 --nix=build.zig.zon.nix build.zig.zon zigDeps = callPackage ./build.zig.zon.nix { }; in stdenv.mkDerivation { pname = "zig-passlib"; version = "0.0.0"; # Named rather than filtered, so that editing something outside this list # -- the flake, a scratch file, a note -- does not rebuild. src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./build.zig ./build.zig.zon ./build.zig.zon.nix ./src ./tests ./tools ./LICENSES ./README.md ./REUSE.toml ]; }; nativeBuildInputs = [ zig_0_16 ]; # A library installs no binary, so what the derivation is for is running # every test in the sandbox, where `--system` hands Zig the dependencies # from the store and forbids fetching anything else. `crosscheck` needs # passlib's python and is left to the devshell. doCheck = true; # `zig build` here installs the API documentation and nothing else. buildPhase = '' runHook preBuild zig build docs --prefix "$out" --cache-dir "$TMPDIR/zig-cache" \ --global-cache-dir "$TMPDIR/zig-global-cache" --system ${zigDeps} runHook postBuild ''; checkPhase = '' runHook preCheck zig build test --summary all --cache-dir "$TMPDIR/zig-cache" \ --global-cache-dir "$TMPDIR/zig-global-cache" --system ${zigDeps} zig build check --cache-dir "$TMPDIR/zig-cache" \ --global-cache-dir "$TMPDIR/zig-global-cache" --system ${zigDeps} runHook postCheck ''; # `zig build docs --prefix` has already put everything in place. installPhase = '' runHook preInstall runHook postInstall ''; meta = { description = "passlib's password hash schemes in Zig"; homepage = "https://git.jcollie.dev/jeff/zig-passlib"; license = lib.licenses.mit; platforms = lib.platforms.all; }; }