# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. # The release build: ianitor-edge and ianitor-control with --no-default-features, so the # crash and write-failure test hooks (IANITOR_TEST_*) are not in the binaries. The built web UI # goes to share/ianitor/web, where control serves it. { lib, rustPlatform, cmake, ianitor-web }: rustPlatform.buildRustPackage { pname = "ianitor"; # One version, the workspace's (scripts/check-version.mjs checks the rest). version = (lib.importTOML ../../Cargo.toml).workspace.package.version; src = lib.fileset.toSource { root = ../..; fileset = lib.fileset.unions [ ../../Cargo.toml ../../Cargo.lock ../../crates ../../tests/diff ../../tests/support # The fuzz crate is a workspace member; its cargo-fuzz project is not (own workspace). (lib.fileset.difference ../../tests/fuzz ../../tests/fuzz/fuzz) ]; }; cargoLock = { lockFile = ../../Cargo.lock; # domi-pki, the shared Domi CA (Cargo.toml pins tag v1.0.0): the NAR hash of its tree at that tag. outputHashes."domi-pki-1.0.0" = "sha256-JdknFJ5cxsI1/MtWmvsItoE6f7znJjUr4C/rwUEz9i4="; }; # libz-ng-sys (Pingora's compression) builds zlib-ng with CMake. nativeBuildInputs = [ cmake ]; dontUseCmakeConfigure = true; cargoBuildFlags = [ "-p" "ianitor-edge" "-p" "ianitor-control" ]; buildNoDefaultFeatures = true; # The test suites need Caddy, Pebble and loopback servers; they run in `cargo test` and in # the NixOS VM tests, not inside this sandboxed build. doCheck = false; postInstall = '' mkdir -p $out/share/ianitor cp -r ${ianitor-web} $out/share/ianitor/web ''; # The release binaries must not carry the test hooks. postFixup = '' if grep -q IANITOR_TEST_CRASH_AT $out/bin/ianitor-control; then echo "the release ianitor-control still has the test hooks" >&2 exit 1 fi ''; meta = { description = "Ianitor Domi: a reverse proxy on Pingora with a small Domi CA, a web UI and an API"; license = lib.licenses.mpl20; mainProgram = "ianitor-control"; platforms = lib.platforms.linux; }; }