2019-07-02 17:40:51 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# This script dispatches invocations transparently to programs instantiated from
|
|
|
|
# Nix.
|
|
|
|
#
|
2019-07-04 12:15:15 +02:00
|
|
|
# To add a new tool, insert it into the case statement below by setting `attr`
|
|
|
|
# to the key in nixpkgs which represents the program you want to run.
|
2019-07-02 17:40:51 +02:00
|
|
|
set -ueo pipefail
|
|
|
|
|
|
|
|
readonly REPO_ROOT=$(git rev-parse --show-toplevel)
|
|
|
|
readonly TARGET_TOOL=$(basename $0)
|
|
|
|
|
|
|
|
case "${TARGET_TOOL}" in
|
|
|
|
git-appraise)
|
2019-07-04 12:15:15 +02:00
|
|
|
attr="thirdParty.gitAppraise"
|
|
|
|
;;
|
|
|
|
stylish-haskell)
|
|
|
|
attr="haskellPackages.stylish-haskell"
|
2019-07-02 17:40:51 +02:00
|
|
|
;;
|
2019-08-15 17:28:42 +02:00
|
|
|
terraform)
|
|
|
|
attr="terraform-gcp"
|
|
|
|
;;
|
2019-08-16 17:50:50 +02:00
|
|
|
kontemplate)
|
|
|
|
attr="kontemplate"
|
|
|
|
;;
|
2019-07-02 17:40:51 +02:00
|
|
|
*)
|
|
|
|
echo "The tool '${TARGET_TOOL}' is currently not installed in this repository."
|
2019-07-04 12:15:15 +02:00
|
|
|
exit 1
|
2019-07-02 17:40:51 +02:00
|
|
|
;;
|
|
|
|
esac
|
2019-07-04 12:15:15 +02:00
|
|
|
|
|
|
|
result=$(nix-build --no-out-link --attr "${attr}" "${REPO_ROOT}")
|
|
|
|
PATH="${result}/bin:$PATH"
|
|
|
|
|
|
|
|
exec "${TARGET_TOOL}" "${@}"
|