fix(ci-builds): typecheck __allTargets to be (list drv)

`nix-build -A` expects a list of derivations, otherwise it will
silently skip some targets. We can use yants to ensure we don’t
accidentally put test targets that do not run on CI.

`depot.users.tazjin.blog` was one such target, the only real drv is
in the `rendered` field.

`getBins` is not a derivation, rather the `runTestsuite` prints `{}`
if it succeeds and aborts the evaluation otherwise. We make it into a
derivation, using the `emptyDerivation` primitive we added earlier.
We could actually improve that still, see the TODO.

Change-Id: I3e7658b21aa4ef84192ac43c11b986bd8570a115
Reviewed-on: https://cl.tvl.fyi/c/depot/+/666
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Profpatsch 2020-06-28 02:56:47 +02:00
parent 1e71ce8a29
commit f28b0d01ef

View file

@ -7,7 +7,16 @@
let let
inherit (builtins) attrNames filter foldl' getAttr substring; inherit (builtins) attrNames filter foldl' getAttr substring;
in lib.fix(self: { # attach a nix expression to a drv so we can “build” it
# TODO(Profpatsch): instead of failing evaluation if a test fails,
# we can put the expression of the test failure into $out
# and continue with the other CI derivations.
drvify = name: exp: depot.nix.emptyDerivation {
inherit name;
owo = lib.generators.toPretty {} exp;
};
in lib.fix (self: {
__apprehendEvaluators = throw '' __apprehendEvaluators = throw ''
Do not evaluate this attribute set directly. It exists only to group builds Do not evaluate this attribute set directly. It exists only to group builds
for CI runs of different "project groups". for CI runs of different "project groups".
@ -27,8 +36,10 @@ in lib.fix(self: {
]; ];
# Combined list of all the targets, used for building everything locally. # Combined list of all the targets, used for building everything locally.
__allTargets = foldl' (x: y: x ++ y) self.__nonpublic __allTargets =
(map (k: getAttr k self) self.__evaluatable); (with depot.nix.yants; list drv)
(foldl' (x: y: x ++ y) self.__nonpublic
(map (k: getAttr k self) self.__evaluatable));
fun = with depot.fun; [ fun = with depot.fun; [
amsterdump amsterdump
@ -62,7 +73,7 @@ in lib.fix(self: {
nix.yants.tests nix.yants.tests
tools.cheddar tools.cheddar
tools.nsfv-setup tools.nsfv-setup
depot.nix.getBins.tests (drvify "getBins-tests" nix.getBins.tests)
]; ];
# Haskell packages we've patched locally # Haskell packages we've patched locally
@ -76,7 +87,7 @@ in lib.fix(self: {
# User-specific build targets # User-specific build targets
tazjin = with depot.users.tazjin; [ tazjin = with depot.users.tazjin; [
blog blog.rendered
emacs emacs
homepage homepage
]; ];