mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
fbbce80443
I'd like to remove `dev-env`. It's served us well, but its original ambitions were to go way beyond a simple `nix-shell` equivalent, and now that it's all we're using it for it doesn't really add much anymore. Using a standard nix-shell setup would reduce the complexity of this repo and make it easier for other developers to jump in. It would also somewhat reduce the dev-env verbosity, which is a minor annoyance. This is, however, a big change, and I don't think trying to do it in one go is a great idea. So instead I'm setting a foundation in this PR and plan to move step by step over several follow-up PRs. In this one I just add a small default nix-shell configuration and add it to `.envrc`. In follow-up PRs, I'll be moving paclages over from the dev-env configuration to the nix shell, up to the point where dev-env is just an empty shell that we can easily remove. This PR also serves as a not-so-implicit way of gathering support for this plan.
37 lines
1.7 KiB
Plaintext
37 lines
1.7 KiB
Plaintext
use nix
|
|
|
|
PATH_add bin
|
|
|
|
[[ -f .envrc.private ]] && source_env .envrc.private
|
|
|
|
## LEGACY
|
|
|
|
echo "[dev-env] Setting up DA Development Environment"
|
|
eval "$(dev-env/bin/dade assist)"
|
|
|
|
DADE_PRE_COMMIT_HOOK_TYPE=pre-push
|
|
|
|
if [ -n "${ARTIFACTORY_USERNAME:-}" ] && [ -n "${ARTIFACTORY_PASSWORD:-}" ]; then
|
|
export ARTIFACTORY_AUTH=$(echo -n "$ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD" | base64 -w0)
|
|
fi
|
|
|
|
# always start from a clean slate to ensure that the install phase produces the scenario described by `DADE_NO_PRE_COMMIT` and `DADE_PRE_COMMIT_HOOK_TYPE`
|
|
# this is a bit unfortunate but it doesn't look like pre-commit currently supports uninstalling all hooks in one go as of version 2.20.0
|
|
HOOK_TYPES=(pre-commit pre-merge-commit pre-push prepare-commit-msg commit-msg post-checkout post-commit post-merge post-rewrite)
|
|
for HOOK_TYPE in ${HOOK_TYPES[@]}; do pre-commit uninstall -t "$HOOK_TYPE" > /dev/null; done
|
|
|
|
# install pre-commit hook (opt-out by setting `DADE_NO_PRE_COMMIT`, set the hook type with `DADE_PRE_COMMIT_HOOK_TYPE` -- defaults to 'pre-push')
|
|
if [[ -z "${DADE_NO_PRE_COMMIT:-}" ]]; then
|
|
pre-commit install -t "$DADE_PRE_COMMIT_HOOK_TYPE" > /dev/null
|
|
fi
|
|
|
|
if [ -z "${RUN_PLATFORM_INDEPENDENCE_CHECK:-}" ]; then
|
|
echo "Warning: platform-independence-checks will be skipped."
|
|
echo "To silence this warning, please set 'RUN_PLATFORM_INDEPENDENCE_CHECK'"
|
|
echo "by running the following line:"
|
|
echo " echo export RUN_PLATFORM_INDEPENDENCE_CHECK=no >> $(pwd)/.envrc.private"
|
|
echo "if you usually work on the compiler, run the following line instead:"
|
|
echo " echo export RUN_PLATFORM_INDEPENDENCE_CHECK=yes >> $(pwd)/.envrc.private"
|
|
export RUN_PLATFORM_INDEPENDENCE_CHECK=no
|
|
fi
|