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
|
|
|
|
|
2020-07-01 22:39:25 +02:00
|
|
|
readonly REPO_ROOT=$(dirname "$0")/..
|
|
|
|
TARGET_TOOL=$(basename "$0")
|
2019-07-02 17:40:51 +02:00
|
|
|
|
|
|
|
case "${TARGET_TOOL}" in
|
2020-01-01 16:54:07 +01:00
|
|
|
age)
|
|
|
|
attr="third_party.age"
|
|
|
|
;;
|
|
|
|
age-keygen)
|
|
|
|
attr="third_party.age"
|
|
|
|
;;
|
2020-07-15 15:51:59 +02:00
|
|
|
depot-build)
|
|
|
|
attr="tools.depot-build"
|
2020-05-17 03:49:13 +02:00
|
|
|
;;
|
2021-07-16 21:07:31 +02:00
|
|
|
depot-nixpkgs-update)
|
|
|
|
attr="tools.depot-nixpkgs-update"
|
|
|
|
;;
|
2020-06-16 02:54:26 +02:00
|
|
|
gerrit)
|
|
|
|
attr="tools.gerrit-cli"
|
|
|
|
;;
|
2020-11-29 04:34:26 +01:00
|
|
|
gerrit-update)
|
|
|
|
attr="tools.gerrit-update"
|
|
|
|
;;
|
2020-07-01 22:29:35 +02:00
|
|
|
hash-password)
|
|
|
|
attr="tools.hash-password"
|
|
|
|
;;
|
2020-07-15 15:51:59 +02:00
|
|
|
kontemplate)
|
|
|
|
attr="kontemplate"
|
|
|
|
;;
|
|
|
|
meson)
|
|
|
|
attr="third_party.meson"
|
|
|
|
;;
|
|
|
|
ninja)
|
|
|
|
attr="third_party.ninja"
|
|
|
|
;;
|
2020-07-15 15:54:18 +02:00
|
|
|
perf-flamegraph)
|
|
|
|
attr="tools.perf-flamegraph"
|
|
|
|
;;
|
2020-07-03 06:26:33 +02:00
|
|
|
rebuild-system)
|
|
|
|
attr="ops.nixos.rebuild-system"
|
|
|
|
;;
|
2020-07-15 15:51:59 +02:00
|
|
|
rebuilder)
|
|
|
|
attr="users.tazjin.nixos.rebuilder"
|
|
|
|
;;
|
|
|
|
rink)
|
|
|
|
attr="third_party.rink"
|
|
|
|
;;
|
|
|
|
stern)
|
|
|
|
attr="third_party.stern"
|
|
|
|
;;
|
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}" "${@}"
|