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
|
|
|
|
|
2019-12-20 21:44:00 +01:00
|
|
|
readonly REPO_ROOT=$(dirname $0)/..
|
2019-12-20 14:13:06 +01:00
|
|
|
TARGET_TOOL=$(basename $0)
|
2019-07-02 17:40:51 +02:00
|
|
|
|
|
|
|
case "${TARGET_TOOL}" in
|
2019-08-15 17:28:42 +02:00
|
|
|
terraform)
|
2019-11-15 16:26:08 +01:00
|
|
|
attr="third_party.terraform-gcp"
|
2019-08-15 17:28:42 +02:00
|
|
|
;;
|
2019-08-16 17:50:50 +02:00
|
|
|
kontemplate)
|
|
|
|
attr="kontemplate"
|
|
|
|
;;
|
2019-09-02 19:18:28 +02:00
|
|
|
stern)
|
2019-12-14 18:40:21 +01:00
|
|
|
attr="third_party.stern"
|
2019-09-02 19:18:28 +02:00
|
|
|
;;
|
2019-12-14 18:40:21 +01:00
|
|
|
kms_pass)
|
2019-12-20 21:37:02 +01:00
|
|
|
attr="ops.kms_pass"
|
2019-12-20 14:13:06 +01:00
|
|
|
TARGET_TOOL="pass"
|
2019-09-03 16:56:31 +02:00
|
|
|
;;
|
2019-12-09 13:27:07 +01:00
|
|
|
aoc2019)
|
2019-12-20 21:18:41 +01:00
|
|
|
attr="fun.aoc2019.${1}"
|
2019-12-09 13:27:07 +01:00
|
|
|
;;
|
2019-12-14 18:47:54 +01:00
|
|
|
rink)
|
|
|
|
attr="third_party.rink"
|
|
|
|
;;
|
2020-01-01 16:54:07 +01:00
|
|
|
age)
|
|
|
|
attr="third_party.age"
|
|
|
|
;;
|
|
|
|
age-keygen)
|
|
|
|
attr="third_party.age"
|
|
|
|
;;
|
2020-01-04 23:48:52 +01:00
|
|
|
rebuilder)
|
2020-06-13 22:52:20 +02:00
|
|
|
attr="users.tazjin.nixos.rebuilder"
|
2020-01-04 23:48:52 +01:00
|
|
|
;;
|
2020-05-17 03:49:13 +02:00
|
|
|
meson)
|
|
|
|
attr="third_party.meson"
|
|
|
|
;;
|
|
|
|
ninja)
|
|
|
|
attr="third_party.ninja"
|
|
|
|
;;
|
2020-06-15 00:01:34 +02:00
|
|
|
git-bug)
|
|
|
|
attr="third_party.git-bug"
|
|
|
|
;;
|
2020-06-15 21:03:47 +02:00
|
|
|
depot-build)
|
|
|
|
attr="tools.depot-build"
|
|
|
|
;;
|
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}" "${@}"
|