You've already forked tribes-plugin-aether
forked from tribes/tribes-plugin-template
1cbcb5ea55
Rename the repo Guix development manifest to manifest.scm and update the wrapper and direnv integration.
68 lines
1.6 KiB
Bash
68 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
export DIRENV_WARN_TIMEOUT=20s
|
|
|
|
# Backend selection:
|
|
# - default: use devenv when available, otherwise Guix
|
|
# - optional local override: write "guix" or "devenv" to .dev-shell
|
|
backend=auto
|
|
if [ -f .dev-shell ]; then
|
|
backend=$(tr -d '[:space:]' < .dev-shell)
|
|
watch_file .dev-shell
|
|
fi
|
|
|
|
use_aether_guix() {
|
|
watch_file manifest.scm
|
|
watch_file guix/channels.scm
|
|
watch_file guix/guix-dev
|
|
watch_file .pre-commit-config.yaml
|
|
watch_file scripts/plugin
|
|
|
|
export GUIX_DEV_ROOT="$PWD"
|
|
eval "$(guix time-machine -C guix/channels.scm -- shell -m manifest.scm --search-paths)"
|
|
|
|
if [ -f .env ]; then set -a; . ./.env; set +a; fi
|
|
export MIX_OS_DEPS_COMPILE_PARTITION_COUNT=8
|
|
export NODE_ENV=development
|
|
export NPM_CONFIG_MIN_RELEASE_AGE=7
|
|
export TRIBES_HOST_ROOT="${TRIBES_HOST_ROOT:-$PWD/../tribes}"
|
|
|
|
plugin() { bash "$PWD/scripts/plugin" "$@"; }
|
|
}
|
|
|
|
use_aether_devenv() {
|
|
eval "$(devenv direnvrc)"
|
|
use devenv
|
|
}
|
|
|
|
case "$backend" in
|
|
auto)
|
|
if command -v devenv >/dev/null 2>&1; then
|
|
use_aether_devenv
|
|
elif command -v guix >/dev/null 2>&1; then
|
|
use_aether_guix
|
|
else
|
|
log_error "neither devenv nor guix is available"
|
|
exit 1
|
|
fi
|
|
;;
|
|
nix|devenv)
|
|
if ! command -v devenv >/dev/null 2>&1; then
|
|
log_error ".dev-shell requested devenv, but devenv is unavailable"
|
|
exit 1
|
|
fi
|
|
use_aether_devenv
|
|
;;
|
|
guix)
|
|
if ! command -v guix >/dev/null 2>&1; then
|
|
log_error ".dev-shell requested guix, but guix is unavailable"
|
|
exit 1
|
|
fi
|
|
use_aether_guix
|
|
;;
|
|
*)
|
|
log_error "unknown .dev-shell backend: $backend"
|
|
exit 1
|
|
;;
|
|
esac
|