about summary refs log tree commit diff
path: root/ci-builds.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2020-06-28T00·56+0200
committerProfpatsch <mail@profpatsch.de>2020-06-29T02·00+0000
commitf28b0d01ef74c0c4e7a305e909bc88bfec0616f4 (patch)
tree5fd15084946e9d6606c60eda72014024859a576c /ci-builds.nix
parent1e71ce8a29c86b0544f4014d7c91bfb0b950a0c8 (diff)
fix(ci-builds): typecheck __allTargets to be (list drv) r/1126
`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>
Diffstat (limited to 'ci-builds.nix')
-rw-r--r--ci-builds.nix21
1 files changed, 16 insertions, 5 deletions
diff --git a/ci-builds.nix b/ci-builds.nix
index 7e09eef52..1e98e8a04 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
   ];