flake reorg, nix integration testing

This commit is contained in:
Robin Appelman 2024-12-24 15:52:24 +01:00
commit 5cfd70d583
14 changed files with 3221 additions and 145 deletions

42
nix/test-runner.nix Normal file
View file

@ -0,0 +1,42 @@
{
rustPlatform,
openssl,
pkg-config,
lib,
}: let
inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile;
src = sourceByRegex ../. ["Cargo.*" "(src|tests)(/.*)?"];
cargoPackage = (fromTOML (readFile ../Cargo.toml)).package;
in
rustPlatform.buildRustPackage {
pname = cargoPackage.name;
inherit (cargoPackage) version;
inherit src;
buildInputs = [
openssl
];
nativeBuildInputs = [
pkg-config
];
doCheck = false;
buildPhase = ''
cargo build --tests
'';
installPhase = ''
mkdir -p $out/bin
cp target/debug/deps/tests-???????????????? $out/bin/api-test
'';
cargoLock = {
lockFile = ../Cargo.lock;
};
meta.mainProgram = "api-test";
}