nix-super/tests/functional/init.sh

43 lines
938 B
Bash
Raw Permalink Normal View History

# Don't start the daemon
source common/vars-and-functions.sh
test -n "$TEST_ROOT"
if test -d "$TEST_ROOT"; then
2023-03-17 05:00:14 +02:00
chmod -R u+rw "$TEST_ROOT"
# We would delete any daemon socket, so let's stop the daemon first.
killDaemon
rm -rf "$TEST_ROOT"
fi
mkdir "$TEST_ROOT"
mkdir "$NIX_STORE_DIR"
2005-02-01 19:50:48 +02:00
mkdir "$NIX_LOCALSTATE_DIR"
2005-02-18 10:40:52 +02:00
mkdir -p "$NIX_LOG_DIR"/drvs
mkdir "$NIX_STATE_DIR"
2005-02-15 11:39:12 +02:00
mkdir "$NIX_CONF_DIR"
2005-02-15 11:39:12 +02:00
cat > "$NIX_CONF_DIR"/nix.conf <<EOF
build-users-group =
keep-derivations = false
sandbox = false
experimental-features = nix-command
gc-reserved-space = 0
substituters =
2020-01-28 17:34:37 +02:00
flake-registry = $TEST_ROOT/registry.json
show-trace = true
2018-02-13 15:16:32 +02:00
include nix.conf.extra
trusted-users = $(whoami)
2018-02-13 15:16:32 +02:00
EOF
cat > "$NIX_CONF_DIR"/nix.conf.extra <<EOF
fsync-metadata = false
extra-experimental-features = flakes
2018-02-13 15:16:32 +02:00
!include nix.conf.extra.not-there
2005-02-15 11:39:12 +02:00
EOF
# Initialise the database.
nix-store --init
# Did anything happen?
test -e "$NIX_STATE_DIR"/db/db.sqlite