feat(users/Profpatsch/writers): make testing default for rustSimple

This way we don’t have to explicitely wrap the rust crate with a
`testRustSimple`, but it will be done automatically, unless `doCheck`
is set to `false`.

Change-Id: I32a81821eeff620e7da57332b0873495bb85a843
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2841
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Profpatsch 2021-04-04 13:05:39 +02:00
parent 5319465f60
commit e7c78570ed
3 changed files with 14 additions and 11 deletions

View file

@ -78,8 +78,11 @@ let
rustSimpleBin = {
name,
dependencies ? [],
doCheck ? true,
...
}@args: src: pkgs.buildRustCrate ({
}@args: src:
(if doCheck then testRustSimple else pkgs.lib.id)
(pkgs.buildRustCrate ({
pname = name;
version = "1.0.0";
crateName = name;
@ -93,13 +96,16 @@ let
cp "$srcPath" $out/src/bin/${name}.rs
find $out
'';
} // args);
} // args));
rustSimpleLib = {
name,
dependencies ? [],
doCheck ? true,
...
}@args: src: pkgs.buildRustCrate ({
}@args: src:
(if doCheck then testRustSimple else pkgs.lib.id)
(pkgs.buildRustCrate ({
pname = name;
version = "1.0.0";
crateName = name;
@ -112,7 +118,7 @@ let
cp "$srcPath" $out/src/lib.rs
find $out
'';
} // args);
} // args));
/* Takes a `buildRustCrate` derivation as an input,
* builds it with `{ buildTests = true; }` and runs
@ -146,6 +152,5 @@ in {
rustSimple
rustSimpleBin
rustSimpleLib
testRustSimple
;
}