Something went wrong. Try again.
A Zig client for the Paperless-ngx REST API, with streaming uploads, task waiting and a command-line tool.
Something went wrong. Try again.
zig-paperless package.nix
2.0 kB · 62 lines
Nix
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
{ lib, stdenv, callPackage, zig_0_17,}:let # Generated from build.zig.zon by zon2nix; regenerate with # nix develop -c zon2nix --17 --nix=build.zig.zon.nix build.zig.zon zigDeps = callPackage ./build.zig.zon.nix { };instdenv.mkDerivation (finalAttrs: { pname = "zig-paperless"; version = "0.1.0";
# Named rather than filtered, so that editing something outside this list -- # the flake, the README, the virtual machine test that consumes the result # -- does not rebuild the package and, in the test, the whole machine. src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./build.zig ./build.zig.zon ./build.zig.zon.nix ./src ./tests/client.zig ./tests/live.zig ./tools ]; };
nativeBuildInputs = [ zig_0_17.hook ];
# A Nix build has no network and the Zig package manager wants one, so the # dependencies are realised by Nix and handed over as a directory. `--system` # forbids fetching outright: a dependency missing from it is a build error # naming the package rather than an attempt to reach 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` and fails in the # sandbox. zigCheckFlags = finalAttrs.zigBuildFlags;
# The unit tests are pure and the client tests want only a loopback socket, # which the build sandbox has. The tests against a real server are # compiled here and run by the flake's `checks`. doCheck = true;
meta = { description = "A Zig client for the Paperless-ngx REST API"; homepage = "https://git.jcollie.dev/jeff/zig-paperless"; license = lib.licenses.mit; mainProgram = "zig-paperless"; platforms = lib.platforms.unix; };})