tvl-depot/tools/tvlc/common.sh
Kane York a9650041bb feat(tools/tvlc): pass list of derivations to depot-scanner
You can now provide a list of Nix derivations to tvlc to get a git worktree + sparse-checkout containing only the paths needed to build the specified derivations.

Known bugs: even though //third_party is only passed to readdir(), git doesn't know this and includes all of //third_party/*.

Change-Id: I9dccebd3fbff4bb04ebd568175cf0a7e37d71ab3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1826
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-25 22:34:02 +00:00

33 lines
738 B
Bash

#!/bin/bash
set -eu
set -o pipefail
source path-scripts
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
tvlc_root="$XDG_DATA_HOME/tvlc"
nice_checkout_root=
if [ -f "$tvlc_root"/nice_checkout_root ]; then
nice_checkout_root="$(cat "$tvlc_root"/nice_checkout_root)"
fi
nice_checkout_root="${nice_checkout_root:-$HOME/tvlc}"
depot_root=
if [ -f "$tvlc_root/depot_root" ]; then
depot_root="$(cat "$tvlc_root/depot_root")"
fi
if [ -d /depot ]; then
# don't require config on tvl nixos servers
depot_root="${depot_root:-/depot}"
fi
if [ -n "$depot_root" ]; then
export DEPOT_ROOT="$depot_root"
fi
if [ ! -d "$tvlc_root" ]; then
echo "tvlc: setup required"
echo "please run 'tvlc setup' from the depot root"
exit 1
fi