Skip to content
Snippets Groups Projects
Commit de320782 authored by Meik Selig's avatar Meik Selig
Browse files

build and run nix

parent 2335c069
No related branches found
No related tags found
1 merge request!11Added nix run
with import <nixpkgs> {};
let build = import ./build.nix;
let
build = import ./build.nix;
run = import ./run.nix;
in rec
{
calc = build {
derivName = "calc";
target = "calc";
buildDependencies = [coreutils];
output = "calc";
};
test = build {
derivName = "test";
target = "unit_test";
buildDependencies = [coreutils catch2];
buildDependencies = [catch2];
output = "unit_test";
};
fuzzCalc = build {
derivName = "fuzz_calc";
target = "fuzz_calc";
buildDependencies = [afl];
output = "fuzz_calc";
};
runTest = run {
derivName = "testResult";
target = "unit_test";
buildDependencies = [catch2];
checkCommand = "make run_test";
output = "unit_test";
};
runFuzz = run {
derivName = "fuzzerResult";
target = "fuzz_calc";
buildDependencies = [afl];
checkCommand = "bash fuzz_seconds.sh ${fuzzCalc}/bin/fuzz_calc";
output = "out/*";
};
}
\ No newline at end of file
run.nix 0 → 100644
{derivName, target, buildDependencies?[], checkCommand, output}:
let pkgs = import <nixpkgs> {};
in
pkgs.stdenv.mkDerivation {
name = derivName;
src = ./.;
output = output;
buildInputs = buildDependencies;
checkCommand = checkCommand;
doCheck = true;
buildPhase = '''';
checkPhase = ''
ls -la
$checkCommand
'';
installPhase = ''
mkdir -p $out/
cp -r $output $out/
'';
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment