about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-06-15T19·03+0100
committertazjin <mail@tazj.in>2020-06-15T19·08+0000
commit29bab159ab780ada20a4ae97956594ea13b38ab4 (patch)
tree253cf1b37f10a7b8afcee432e080e7ce3bf4abca /tools
parentc26ee5a448b0b2f509ee704ebffaa665400a2216 (diff)
feat(depot-build): Add a tool to build at arbitrary tree locations r/970
Assuming you're in `/depot/fun/clbot`, you can do this:

    tazjin@frog /d/f/clbot (master)> depot-build
    Building //fun/clbot
    /nix/store/i1zc6g58wa4819kyhaqi12zsh3hr31ph-clbot

It is automatically added to the $PATH using direnv, too.

Change-Id: Ia3341704e6317c2b8de40a3fa1be3b680d21a42d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/388
Reviewed-by: eta <eta@theta.eu.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/depot-build.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/depot-build.nix b/tools/depot-build.nix
new file mode 100644
index 0000000000..5661d58760
--- /dev/null
+++ b/tools/depot-build.nix
@@ -0,0 +1,8 @@
+# Utility script for building any arbitrary depot path in its folder.
+{ pkgs, ... }:
+
+pkgs.writeShellScriptBin "depot-build" ''
+  TARGET=$(git rev-parse --show-prefix | sed 's|/$||')
+  echo "Building //$TARGET"
+  nix-build -A $(echo $TARGET | sed 's|/|.|') $(${pkgs.git}/bin/git rev-parse --show-toplevel)
+''