about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-09-08T22·20+0200
committersterni <sternenseemann@systemli.org>2021-09-09T15·57+0000
commit3a8925239a690a97804cfe7196c6c23c32d7306f (patch)
tree5c7670846e4e6df5aee7698c87897b47802f5bc3
parent23dd8067c534d97bbd1820377998379beac1b205 (diff)
refactor(web/bubblegum): only rebuild examples on dependency change r/2831
Using sparseTree we can make a (surprisingly long) list of things from
depot the examples depend on and create a stripped down depot version
which only contains them. As a result the examples are no longer rebuilt
on every commit.

Change-Id: I3693570ca4bdbbf9da795e552f278f3b1b1b77a9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3504
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
-rw-r--r--web/bubblegum/default.nix21
1 files changed, 20 insertions, 1 deletions
diff --git a/web/bubblegum/default.nix b/web/bubblegum/default.nix
index ed4e48839b89..0ad541390bb7 100644
--- a/web/bubblegum/default.nix
+++ b/web/bubblegum/default.nix
@@ -6,8 +6,27 @@ let
     runExecline
     getBins
     utils
+    sparseTree
     ;
 
+  minimalDepot = sparseTree depot.path [
+    # general depot things
+    (depot.path + "/default.nix")
+    (depot.path + "/nix/readTree")
+    # nixpkgs for lib and packages
+    (depot.path + "/third_party/nixpkgs")
+    (depot.path + "/third_party/overlays")
+    # bubblegum and its dependencies
+    (depot.path + "/web/bubblegum")
+    (depot.path + "/nix/runExecline")
+    (depot.path + "/nix/utils")
+    (depot.path + "/nix/sparseTree")
+    # tvix docs for svg demo
+    (depot.path + "/tvix/docs")
+    # for blog.nix
+    (depot.path + "/users/sterni/nix")
+  ];
+
   statusCodes = {
     # 1xx
     "Continue" = 100;
@@ -205,7 +224,7 @@ let
       ] ++ [
         "${bins.nint}"
         # always pass depot so scripts can use this library
-        "--arg depot '(import ${depot.path} {})'"
+        "--arg depot '(import ${minimalDepot} {})'"
       ]);
     in runExecline.local drvName {} [
       "importas" "out" "out"