-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
37 lines (32 loc) · 784 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
#! /usr/bin/env bash
# We need $FLAKE for our impurity
export FLAKE=$PWD
# Save $FLAKE to a file
echo "\"$FLAKE\"" > "$FLAKE/.flakepath"
dotenv_if_exists /run/user/1000/agenix/cloudflare
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 \
"--setenv=FISH_PID=$FISH_PID" \
"--setenv=PATH" \
"$FLAKE/bin/build-repofarm"
fi
else
export DIRENV_FINISHED="y"
echo "Using cached repoenv"
fi
PATH_add "$FLAKE/.nix/bin"