diff --git a/nix/default.nix b/nix/default.nix index c357f1f..58b34eb 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -4,6 +4,7 @@ ocamlPackages, version, debug ? false, + doCheck ? false, ... }: ocamlPackages.buildDunePackage { @@ -19,12 +20,19 @@ ocamlPackages.buildDunePackage { if debug then '' runHook preBuild - dune build --profile debug -p culr ''${enableParallelBuilding:+-j $NIX_BUILD_CORES} + dune build -p culr --profile debug ''${enableParallelBuilding:+-j $NIX_BUILD_CORES} runHook postBuild '' else '' runHook preBuild - dune build --profile release -p culr ''${enableParallelBuilding:+-j $NIX_BUILD_CORES} + dune build -p culr --profile release ''${enableParallelBuilding:+-j $NIX_BUILD_CORES} runHook postBuild ''; + + checkPhase = '' + dune runtest + ''; + inherit doCheck; + + meta.mainProgram = "culr"; } diff --git a/nix/test.nix b/nix/test.nix index 9efa93a..6a615b3 100644 --- a/nix/test.nix +++ b/nix/test.nix @@ -10,11 +10,14 @@ pkgs.stdenvNoCC.mkDerivation { version = "${version}"; nativebuildInputs = [culr]; - + src = ./.; doCheck = true; checkPhase = '' - CULRS="(255,0,0);(0,0,255)" - CULR_ORDER=1,0 + CULRS="(255,0,0);(0,0,255);#00FF00" + CULR_ORDER="1;0;2" echo "one two three four" | ${lib.getExe culr} ''; + installPhase = '' + mkdir "$out" + ''; }