forked from M-Labs/nac3
flake: run nac3standalone demo checks
also keep auxiliary projects in separate Nix outputs
This commit is contained in:
parent
2a0caf931f
commit
ba997ae094
26
flake.nix
26
flake.nix
|
@ -52,17 +52,33 @@
|
||||||
nac3artiq = pkgs.python3Packages.toPythonModule (
|
nac3artiq = pkgs.python3Packages.toPythonModule (
|
||||||
pkgs.rustPlatform.buildRustPackage {
|
pkgs.rustPlatform.buildRustPackage {
|
||||||
name = "nac3artiq";
|
name = "nac3artiq";
|
||||||
|
outputs = [ "out" "runkernel" "standalone" ];
|
||||||
src = self;
|
src = self;
|
||||||
cargoLock = { lockFile = ./Cargo.lock; };
|
cargoLock = { lockFile = ./Cargo.lock; };
|
||||||
nativeBuildInputs = [ pkgs.python3 pkgs.llvmPackages_13.clang-unwrapped llvm-nac3 ];
|
nativeBuildInputs = [ pkgs.python3 pkgs.llvmPackages_13.clang-unwrapped llvm-nac3 ];
|
||||||
buildInputs = [ pkgs.python3 llvm-nac3 ];
|
buildInputs = [ pkgs.python3 llvm-nac3 ];
|
||||||
cargoBuildFlags = [ "--package" "nac3artiq" ];
|
checkInputs = [ (pkgs.python3.withPackages(ps: [ ps.numpy ])) ];
|
||||||
cargoTestFlags = [ "--package" "nac3ast" "--package" "nac3parser" "--package" "nac3core" "--package" "nac3artiq" ];
|
checkPhase =
|
||||||
|
''
|
||||||
|
echo "Checking nac3standalone demos..."
|
||||||
|
pushd nac3standalone/demo
|
||||||
|
patchShebangs .
|
||||||
|
./check_demos.sh
|
||||||
|
popd
|
||||||
|
echo "Running Cargo tests..."
|
||||||
|
cargoCheckHook
|
||||||
|
'';
|
||||||
installPhase =
|
installPhase =
|
||||||
''
|
''
|
||||||
TARGET_DIR=$out/${pkgs.python3Packages.python.sitePackages}
|
PYTHON_SITEPACKAGES=$out/${pkgs.python3Packages.python.sitePackages}
|
||||||
mkdir -p $TARGET_DIR
|
mkdir -p $PYTHON_SITEPACKAGES
|
||||||
cp target/x86_64-unknown-linux-gnu/release/libnac3artiq.so $TARGET_DIR/nac3artiq.so
|
cp target/x86_64-unknown-linux-gnu/release/libnac3artiq.so $PYTHON_SITEPACKAGES/nac3artiq.so
|
||||||
|
|
||||||
|
mkdir -p $runkernel/bin
|
||||||
|
cp target/x86_64-unknown-linux-gnu/release/runkernel $runkernel/bin
|
||||||
|
|
||||||
|
mkdir -p $standalone/bin
|
||||||
|
cp target/x86_64-unknown-linux-gnu/release/nac3standalone $standalone/bin
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -7,7 +7,14 @@ if [ -z "$1" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e ../../target/release/nac3standalone ]; then
|
||||||
|
nac3standalone=../../target/release/nac3standalone
|
||||||
|
else
|
||||||
|
# used by Nix builds
|
||||||
|
nac3standalone=../../target/x86_64-unknown-linux-gnu/release/nac3standalone
|
||||||
|
fi
|
||||||
|
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
../../target/release/nac3standalone $1
|
$nac3standalone $1
|
||||||
rustc -o demo demo.rs -Clink-arg=./module.o
|
rustc -o demo demo.rs -Clink-arg=./module.o
|
||||||
./demo
|
./demo
|
||||||
|
|
Loading…
Reference in New Issue