-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·44 lines (39 loc) · 947 Bytes
/
build.sh
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
#!/usr/bin/env bash
set -e
self="$(realpath "$0")"
path="$(dirname "$self")"
echo "Working in $path"
cd "$path"
export LANG="C.UTF-8"
function nixify() {
read -r -a args <<< "$(grep -v '^\s*$' .keep.env | sed "s/^/--keep /;s/$/ /" | tr '\n' ' ')"
if [[ -z "${IN_NIX_SHELL+x}" ]]; then
echo "Restarting in Nix..."
set -x
nix flake lock
nix flake metadata
exec nix develop \
--ignore-environment \
--keep HOME \
--keep CI_BRANCH \
--keep CI_COMMIT \
--keep CI_BRANCH_TAG \
--keep CI_PULL_REQUEST \
--keep CI_BUILD_UNIQ_SUFFIX \
--keep CI \
"${args[@]}" \
--command bash "$self" "$@"
fi
}
for i in "$@"
do
case $i in
nix) shift && nixify "$@" ;;
env) exec bash -norc ;;
*) if [[ -f "./devops/mods/$i.sh" ]]; then
source "./devops/mods/$i.sh"
else
"./devops/$i.sh"
fi ;;
esac
done