62 lines
2.2 KiB
Nix
62 lines
2.2 KiB
Nix
# SPDX-License-Identifier: CPAL-1.0
|
|
# Copyright (c) 2026 Marek Novák. Part of Ianitor, under the Common Public Attribution
|
|
# License 1.0: see LICENSE (its Exhibit A is this file's notice).
|
|
|
|
# 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.1, CPAL-1.0): the NAR hash of its tree at that tag.
|
|
outputHashes."domi-pki-1.0.1" = lib.fakeHash;
|
|
};
|
|
# 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.cpal10;
|
|
mainProgram = "ianitor-control";
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
}
|