-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.envrc
39 lines (35 loc) · 799 Bytes
/
.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
#! /usr/bin/env bash
# We need $FLAKE for our impurity
export FLAKE=$PWD
export TF_VAR_FLAKE=$FLAKE
watch_file .nix
PATH_add "$FLAKE/bin"
# Cache PATH from nix develop for one hour
if ! has fd || ! fd --type l --no-ignore --max-depth 1 --hidden --quiet --changed-within 1h .nix
then
if ! systemctl \
is-active \
--user \
--quiet \
repofarm
then
echo "Building repoenv"
export DIRENV_FINISHED="n"
systemd-run \
--user \
--quiet \
--unit repofarm \
--same-dir \
--setenv=FISH_PID \
--setenv=FLAKE \
--setenv=PATH \
"$FLAKE/bin/build-repofarm"
else
echo "Waiting for repoenv build"
fi
else
export DIRENV_FINISHED="y"
echo "Using cached repoenv"
fi
PATH_add "$FLAKE/.nix/bin"
source_env_if_exists ./.privrc