-
Notifications
You must be signed in to change notification settings - Fork 323
/
.envrc
70 lines (56 loc) · 2.19 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Build a folder ./.env that contains the dev-shell which load all the right env
# vars.
#
# To speed up the nix evaluation, we only rebuild our environment when `./nix`
# or any of the `default.nix` files change. We do this by adding all these files
# to the nix store and using the store paths as a cache key.
nix_files=$(find . -name '*.nix' | grep -v '^./dist-newstyle')
for nix_file in $nix_files; do
watch_file "$nix_file"
done
store_paths=$(echo "$nix_files" | xargs nix-store --add ./nix)
layout_dir=$(direnv_layout_dir)
env_dir=./.env
export NIX_CONFIG='extra-experimental-features = nix-command'
[[ -d "$layout_dir" ]] || mkdir -p "$layout_dir"
if [[ ! -d "$env_dir" || ! -f "$layout_dir/nix-rebuild" || "$store_paths" != $(< "$layout_dir/nix-rebuild" ) ]]; then
bcmd=nix
if command -v nom &> /dev/null; then
if [[ "${USE_NOM}" != "0" ]]; then
bcmd=nom
fi
fi
echo "🔧 Building environment"
$bcmd build -f nix wireServer.devEnv -Lv --out-link ./.env
echo "$store_paths" > "$layout_dir/nix-rebuild"
fi
PATH_add "./.env/bin"
PATH_add "./.env-hs-run/bin"
path_add "PKG_CONFIG_PATH" "./.env/lib/pkgconfig"
path_add "LIBRARY_PATH" "./.env/lib"
path_add "PYTHONPATH" "./hack/python"
PATH_add "./dist"
# source .profile from `$env`. This sets NIX_PATH to pkgs defined in
# ./nix/default.nix. Tis is useful for nix tooling that runs inside this direnv,
# e.g. "nix-shell -p foo" will get "foo" for pkgs defined in ./nix/default.nix
[[ -f "./.env/.profile" ]] && source_env "./.env/.profile"
# Locale
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# RabbitMQ
export RABBITMQ_USERNAME=guest
export RABBITMQ_PASSWORD=alpaca-grapefruit
# Redis
export REDIS_PASSWORD=very-secure-redis-cluster-password
export REDIS_ADDITIONAL_WRITE_PASSWORD=very-secure-redis-master-password
# Integration tests
export INTEGRATION_DYNAMIC_BACKENDS_POOLSIZE=3
# AWS credentials for locally running services
# Keep these in sync with deploy/dockerephmeral/init.sh
export AWS_REGION="eu-west-1"
export AWS_ACCESS_KEY_ID="dummykey"
export AWS_SECRET_ACCESS_KEY="dummysecret"
# integration test suite timeout
export TEST_TIMEOUT_SECONDS=2
# allow local .envrc overrides
[[ -f .envrc.local ]] && source_env .envrc.local