2021-12-09 15:16:18 +00:00
|
|
|
set -eu -o pipefail
|
2021-12-09 15:16:18 +00:00
|
|
|
|
2021-12-09 15:16:18 +00:00
|
|
|
# Don't start the daemon
|
|
|
|
source common/vars-and-functions.sh
|
2006-03-01 12:15:33 +00:00
|
|
|
|
2004-05-04 12:15:30 +00:00
|
|
|
test -n "$TEST_ROOT"
|
|
|
|
if test -d "$TEST_ROOT"; then
|
|
|
|
chmod -R u+w "$TEST_ROOT"
|
2021-12-09 15:16:18 +00:00
|
|
|
# We would delete any daemon socket, so let's stop the daemon first.
|
2021-12-09 15:16:18 +00:00
|
|
|
killDaemon
|
2004-05-04 12:15:30 +00:00
|
|
|
rm -rf "$TEST_ROOT"
|
|
|
|
fi
|
|
|
|
mkdir "$TEST_ROOT"
|
|
|
|
|
|
|
|
mkdir "$NIX_STORE_DIR"
|
2005-02-01 17:50:48 +00:00
|
|
|
mkdir "$NIX_LOCALSTATE_DIR"
|
2005-02-18 08:40:52 +00:00
|
|
|
mkdir -p "$NIX_LOG_DIR"/drvs
|
2004-05-04 12:15:30 +00:00
|
|
|
mkdir "$NIX_STATE_DIR"
|
2005-02-15 09:39:12 +00:00
|
|
|
mkdir "$NIX_CONF_DIR"
|
2004-05-04 12:15:30 +00:00
|
|
|
|
2005-02-15 09:39:12 +00:00
|
|
|
cat > "$NIX_CONF_DIR"/nix.conf <<EOF
|
2014-05-02 17:02:10 +00:00
|
|
|
build-users-group =
|
2017-08-31 12:28:25 +00:00
|
|
|
keep-derivations = false
|
2018-11-07 16:08:28 +00:00
|
|
|
sandbox = false
|
2019-10-16 15:45:09 +00:00
|
|
|
experimental-features = nix-command flakes
|
2020-07-02 14:37:30 +00:00
|
|
|
gc-reserved-space = 0
|
2020-12-09 13:53:45 +00:00
|
|
|
substituters =
|
2020-01-28 15:34:37 +00:00
|
|
|
flake-registry = $TEST_ROOT/registry.json
|
2021-02-05 11:11:50 +00:00
|
|
|
show-trace = true
|
2018-02-13 13:16:32 +00:00
|
|
|
include nix.conf.extra
|
2021-07-26 04:54:55 +00:00
|
|
|
trusted-users = $(whoami)
|
2018-02-13 13:16:32 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > "$NIX_CONF_DIR"/nix.conf.extra <<EOF
|
2010-02-24 13:12:57 +00:00
|
|
|
fsync-metadata = false
|
2018-02-13 13:16:32 +00:00
|
|
|
!include nix.conf.extra.not-there
|
2005-02-15 09:39:12 +00:00
|
|
|
EOF
|
|
|
|
|
2004-05-04 12:15:30 +00:00
|
|
|
# Initialise the database.
|
2011-10-10 21:32:34 +00:00
|
|
|
nix-store --init
|
2004-05-04 12:15:30 +00:00
|
|
|
|
|
|
|
# Did anything happen?
|
2016-07-27 15:14:41 +00:00
|
|
|
test -e "$NIX_STATE_DIR"/db/db.sqlite
|