From f28b0d01ef74c0c4e7a305e909bc88bfec0616f4 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sun, 28 Jun 2020 02:56:47 +0200 Subject: fix(ci-builds): typecheck __allTargets to be (list drv) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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 Reviewed-by: tazjin --- ci-builds.nix | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/ci-builds.nix b/ci-builds.nix index 7e09eef523..1e98e8a041 100644 --- a/ci-builds.nix +++ b/ci-builds.nix @@ -7,7 +7,16 @@ let 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 '' Do not evaluate this attribute set directly. It exists only to group builds 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. - __allTargets = foldl' (x: y: x ++ y) self.__nonpublic - (map (k: getAttr k self) self.__evaluatable); + __allTargets = + (with depot.nix.yants; list drv) + (foldl' (x: y: x ++ y) self.__nonpublic + (map (k: getAttr k self) self.__evaluatable)); fun = with depot.fun; [ amsterdump @@ -62,7 +73,7 @@ in lib.fix(self: { nix.yants.tests tools.cheddar tools.nsfv-setup - depot.nix.getBins.tests + (drvify "getBins-tests" nix.getBins.tests) ]; # Haskell packages we've patched locally @@ -76,7 +87,7 @@ in lib.fix(self: { # User-specific build targets tazjin = with depot.users.tazjin; [ - blog + blog.rendered emacs homepage ]; -- cgit 1.4.1