Files
ianitor/deploy/nixos/package.nix
T

55 lines
1.7 KiB
Nix

# 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";
version = "0.1.0";
src = lib.fileset.toSource {
root = ../..;
fileset = lib.fileset.unions [
../../Cargo.toml
../../Cargo.lock
../../crates
../../tests/diff
../../tests/support
];
};
cargoLock.lockFile = ../../Cargo.lock;
# 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;
};
}