-
Notifications
You must be signed in to change notification settings - Fork 1
/
vbox-compost.sh
executable file
·37 lines (30 loc) · 816 Bytes
/
vbox-compost.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
#! /usr/bin/env bash
set -o pipefail
prog=$0
error() {
echo "Whoops! Looks like $1:$2 failed."
echo "Please try rerunning $prog again."
exit 1
}
trap 'error "${BASH_SOURCE}" "${LINENO}"' ERR
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd $DIR
source utils.sh
check isNonRootUser || exitWithMessage 1 "Do not run as root."
if check fileExists /etc/bash.bashrc; then
if ! check fileExists /etc/bashrc; then
echoRun sudo ln -s /etc/bash.bashrc /etc/bashrc
fi
fi
setupNix
ensureRepo "nix-machines"
ensureOverlay
readyPinned nixos-19.03
nix-build ./nix-up -A installer
exec ./result/bin/up-installer