-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.envrc
More file actions
25 lines (20 loc) · 723 Bytes
/
.envrc
File metadata and controls
25 lines (20 loc) · 723 Bytes
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
#!/bin/sh
watch_file flake.nix
watch_file flake.lock
watch_file devenv.nix
# If 1Password CLI is installed and there are 1password secret references
# then inject the secrets and source the resulting file.
if [ -e .env ]; then
COMPUTED_ENV="${TMPDIR}/$(pwd | sha1).env"
if [ ! -e $COMPUTED_ENV ]; then
op inject -i .env > $COMPUTED_ENV
chmod g-rw,o-rw $COMPUTED_ENV
fi
source $COMPUTED_ENV
fi
DEVENV_ROOT_FILE="$(mktemp)"
printf %s "$PWD" > "$DEVENV_ROOT_FILE"
if ! use flake path:. --override-input devenv-root "file+file://$DEVENV_ROOT_FILE"
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi