Something went wrong. Try again.
An allocation-free Zig library for parsing, validating, formatting and classifying IPv4 and IPv6 addresses, networks, ranges and endpoints.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
{ lib, stdenv, zig,}:let # build.zig.zon is the one place the version is written. The leading # whitespace in the pattern keeps `.minimum_zig_version` from matching. versionMatch = builtins.match ''.*[[:space:]]\.version[[:space:]]*=[[:space:]]*"([^"]+)".*'' ( builtins.readFile ./build.zig.zon );instdenv.mkDerivation (finalAttrs: { pname = "z46"; version = if versionMatch == null then throw "package.nix: no .version found in build.zig.zon" else builtins.head versionMatch;
# Only what the build reads, so that editing the README or the workflow does # not rebuild the package. `tools` is here because build.zig declares the # benchmark and documentation-server steps from it, and the test step builds # both. src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./build.zig ./build.zig.zon ./src ./tools ]; };
# The setup hook ships inside the compiler package; it supplies the build, # check and install phases and builds ReleaseSafe for a baseline CPU. nativeBuildInputs = [ zig ];
# The library needs nothing from the host, so the whole suite runs in the # sandbox exactly as it does in CI. doCheck = true;
meta = { description = "Validate and describe IPv4 and IPv6 addresses, networks, ranges and endpoints"; homepage = "https://git.jcollie.dev/jeff/z46"; license = lib.licenses.mit; mainProgram = "z46"; platforms = lib.platforms.unix; };})