tvl-depot/tools/depot-build.nix
Vincent Ambo 29bab159ab feat(depot-build): Add a tool to build at arbitrary tree locations
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>
2020-06-15 19:08:53 +00:00

8 lines
309 B
Nix

# 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)
''