Something went wrong. Try again.
A reader for SNMP MIB modules: SMIv1 and SMIv2, in Zig.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
{ lib, stdenv, zig_0_17,}:
stdenv.mkDerivation { pname = "zig-smi"; version = "0.2.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 ./src ./tests ./tools ./LICENSES ./README.md ./REUSE.toml ]; };
nativeBuildInputs = [ zig_0_17 ];
# No `zigBuildFlags = [ "--system" ... ]` here, and none needed: the # manifest names no dependencies, so the build fetches nothing and the # sandbox has nothing to be denied.
# This is the whole point of the derivation. A library installs no binary -- # `$out` ends up holding only the documentation -- so what is being checked # is that every module compiles and every test passes. doCheck = true;
# No `--global-cache-dir`: `zig build` stopped taking one in 0.17, and the # setup hook already points `ZIG_GLOBAL_CACHE_DIR` somewhere writable. # # `zig build` here installs the API documentation and nothing else, since # there is no artifact to install. That makes the package useful for the # workflow's publish job as well as for `nix flake check`. buildPhase = '' runHook preBuild zig build docs --prefix "$out" --cache-dir "$TMPDIR/zig-cache" runHook postBuild '';
checkPhase = '' runHook preCheck zig build test --summary all --cache-dir "$TMPDIR/zig-cache" zig build check --cache-dir "$TMPDIR/zig-cache" runHook postCheck '';
# `zig build docs --prefix` has already put everything in place. installPhase = '' runHook preInstall runHook postInstall '';
meta = { description = "A reader for SNMP MIB modules, SMIv1 and SMIv2, in Zig"; homepage = "https://git.jcollie.dev/jeff/zig-smi"; license = lib.licenses.mit; platforms = lib.platforms.all; };}