lix/tests/init.sh

39 lines
773 B
Bash
Raw Normal View History

source common.sh
test -n "$TEST_ROOT"
if test -d "$TEST_ROOT"; then
chmod -R u+w "$TEST_ROOT"
rm -rf "$TEST_ROOT"
fi
mkdir "$TEST_ROOT"
mkdir "$NIX_STORE_DIR"
2005-02-01 18:50:48 +01:00
mkdir "$NIX_LOCALSTATE_DIR"
2005-02-18 09:40:52 +01:00
mkdir -p "$NIX_LOG_DIR"/drvs
mkdir "$NIX_STATE_DIR"
2005-02-15 10:39:12 +01:00
mkdir "$NIX_CONF_DIR"
2005-02-15 10:39:12 +01:00
cat > "$NIX_CONF_DIR"/nix.conf <<EOF
build-users-group =
keep-derivations = false
sandbox = false
experimental-features = nix-command flakes nix-testing
gc-reserved-space = 0
substituters =
2020-01-28 16:34:37 +01:00
flake-registry = $TEST_ROOT/registry.json
2018-02-13 14:16:32 +01:00
include nix.conf.extra
EOF
cat > "$NIX_CONF_DIR"/nix.conf.extra <<EOF
fsync-metadata = false
2018-02-13 14:16:32 +01:00
!include nix.conf.extra.not-there
2005-02-15 10:39:12 +01:00
EOF
# Initialise the database.
nix-store --init
# Did anything happen?
test -e "$NIX_STATE_DIR"/db/db.sqlite
2008-12-03 17:15:38 +01:00
echo 'Hello World' > ./dummy