about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-07-27T15·14+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-08-10T16·05+0200
commit2fad86f361d5f6a4896a0364e313f61384945111 (patch)
treec3f119f5260845e5bae15db6c32090521ff3e719
parentbe64fbb50129356a03d8b7fe08d3ef3809a4a82a (diff)
Remove $NIX_DB_DIR
This variable has no reason to exist, given $NIX_STATE_DIR.
-rw-r--r--doc/manual/command-ref/env-common.xml9
-rw-r--r--release.nix1
-rw-r--r--src/libmain/shared.cc1
-rw-r--r--src/libstore/globals.cc1
-rw-r--r--src/libstore/globals.hh3
-rw-r--r--src/libstore/local-store.cc2
-rw-r--r--tests/common.sh.in7
-rw-r--r--tests/dump-db.sh3
-rw-r--r--tests/init.sh5
-rw-r--r--tests/referrers.sh2
-rw-r--r--tests/remote-store.sh2
-rw-r--r--tests/user-envs.sh5
12 files changed, 11 insertions, 30 deletions
diff --git a/doc/manual/command-ref/env-common.xml b/doc/manual/command-ref/env-common.xml
index 27efef945f15..c757cb17bd10 100644
--- a/doc/manual/command-ref/env-common.xml
+++ b/doc/manual/command-ref/env-common.xml
@@ -129,15 +129,6 @@ $ mount -o bind /mnt/otherdisk/nix /nix</screen>
 </varlistentry>
 
 
-<varlistentry><term><envar>NIX_DB_DIR</envar></term>
-
-  <listitem><para>Overrides the location of the Nix database (default
-  <filename><replaceable>$NIX_STATE_DIR</replaceable>/db</filename>, i.e.,
-  <filename><replaceable>prefix</replaceable>/var/nix/db</filename>).</para></listitem>
-
-</varlistentry>
-
-
 <varlistentry><term><envar>NIX_CONF_DIR</envar></term>
 
   <listitem><para>Overrides the location of the Nix configuration
diff --git a/release.nix b/release.nix
index 1da34443dd4f..8b8d96a2ec55 100644
--- a/release.nix
+++ b/release.nix
@@ -236,7 +236,6 @@ let
     tests.evalNixOS =
       pkgs.runCommand "eval-nixos" { buildInputs = [ build.x86_64-linux ]; }
         ''
-          export NIX_DB_DIR=$TMPDIR
           export NIX_STATE_DIR=$TMPDIR
           nix-store --init
 
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 515d80091de3..5af7c46e86da 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -252,7 +252,6 @@ void printVersion(const string & programName)
         std::cout << "Configuration file: " << settings.nixConfDir + "/nix.conf" << "\n";
         std::cout << "Store directory: " << settings.nixStore << "\n";
         std::cout << "State directory: " << settings.nixStateDir << "\n";
-        std::cout << "Database directory: " << settings.nixDBPath << "\n";
     }
     throw Exit();
 }
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index c12178e4028a..7bf48be378f8 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -69,7 +69,6 @@ void Settings::processEnvironment()
     nixDataDir = canonPath(getEnv("NIX_DATA_DIR", NIX_DATA_DIR));
     nixLogDir = canonPath(getEnv("NIX_LOG_DIR", NIX_LOG_DIR));
     nixStateDir = canonPath(getEnv("NIX_STATE_DIR", NIX_STATE_DIR));
-    nixDBPath = getEnv("NIX_DB_DIR", nixStateDir + "/db");
     nixConfDir = canonPath(getEnv("NIX_CONF_DIR", NIX_CONF_DIR));
     nixLibexecDir = canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR));
     nixBinDir = canonPath(getEnv("NIX_BIN_DIR", NIX_BIN_DIR));
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 65f763ace3c7..3194193bc842 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -51,9 +51,6 @@ struct Settings {
     /* The directory where state is stored. */
     Path nixStateDir;
 
-    /* The directory where we keep the SQLite database. */
-    Path nixDBPath;
-
     /* The directory where configuration files are stored. */
     Path nixConfDir;
 
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 96ce6a0d893b..f9610912307d 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -39,7 +39,7 @@ namespace nix {
 LocalStore::LocalStore(const Params & params)
     : LocalFSStore(params)
     , realStoreDir(get(params, "real", storeDir))
-    , dbDir(get(params, "state", "") != "" ? get(params, "state", "") + "/db" : settings.nixDBPath)
+    , dbDir(stateDir + "/db")
     , linksDir(realStoreDir + "/.links")
     , reservedPath(dbDir + "/reserved")
     , schemaPath(dbDir + "/schema")
diff --git a/tests/common.sh.in b/tests/common.sh.in
index 097d94bb1eea..316d5f6896bb 100644
--- a/tests/common.sh.in
+++ b/tests/common.sh.in
@@ -12,7 +12,6 @@ fi
 export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
 export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
 export NIX_STATE_DIR=$TEST_ROOT/var/nix
-export NIX_DB_DIR=$TEST_ROOT/db
 export NIX_CONF_DIR=$TEST_ROOT/etc
 export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
 export _NIX_TEST_SHARED=$TEST_ROOT/shared
@@ -51,12 +50,10 @@ clearStore() {
     chmod -R +w "$NIX_STORE_DIR"
     rm -rf "$NIX_STORE_DIR"
     mkdir "$NIX_STORE_DIR"
-    rm -rf "$NIX_DB_DIR"
-    mkdir "$NIX_DB_DIR"
+    rm -rf "$NIX_STATE_DIR"
+    mkdir "$NIX_STATE_DIR"
     nix-store --init
     clearProfiles
-    rm -f "$NIX_STATE_DIR"/gcroots/auto/*
-    rm -f "$NIX_STATE_DIR"/gcroots/ref
 }
 
 clearCache() {
diff --git a/tests/dump-db.sh b/tests/dump-db.sh
index 57c8c401600d..d6eea42aa04e 100644
--- a/tests/dump-db.sh
+++ b/tests/dump-db.sh
@@ -8,8 +8,7 @@ deps="$(nix-store -qR $TEST_ROOT/result)"
 
 nix-store --dump-db > $TEST_ROOT/dump
 
-rm -rf $NIX_DB_DIR
-mkdir $NIX_DB_DIR
+rm -rf $NIX_STATE_DIR/db
 
 nix-store --load-db < $TEST_ROOT/dump
 
diff --git a/tests/init.sh b/tests/init.sh
index 5be999e4b1be..4571b75b859e 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -1,7 +1,5 @@
 source common.sh
 
-echo "NIX_STORE_DIR=$NIX_STORE_DIR NIX_DB_DIR=$NIX_DB_DIR"
-
 test -n "$TEST_ROOT"
 if test -d "$TEST_ROOT"; then
     chmod -R u+w "$TEST_ROOT"
@@ -13,7 +11,6 @@ mkdir "$NIX_STORE_DIR"
 mkdir "$NIX_LOCALSTATE_DIR"
 mkdir -p "$NIX_LOG_DIR"/drvs
 mkdir "$NIX_STATE_DIR"
-mkdir "$NIX_DB_DIR"
 mkdir "$NIX_CONF_DIR"
 
 cat > "$NIX_CONF_DIR"/nix.conf <<EOF
@@ -28,6 +25,6 @@ EOF
 nix-store --init
 
 # Did anything happen?
-test -e "$NIX_DB_DIR"/db.sqlite
+test -e "$NIX_STATE_DIR"/db/db.sqlite
 
 echo 'Hello World' > ./dummy
diff --git a/tests/referrers.sh b/tests/referrers.sh
index 5c1ef20cfeb4..8ab8e5ddfe87 100644
--- a/tests/referrers.sh
+++ b/tests/referrers.sh
@@ -30,7 +30,7 @@ echo "collecting garbage..."
 ln -sfn $reference "$NIX_STATE_DIR"/gcroots/ref
 nix-store --gc
 
-if [ -n "$(type -p sqlite3)" -a "$(sqlite3 $NIX_DB_DIR/db.sqlite 'select count(*) from Refs')" -ne 0 ]; then
+if [ -n "$(type -p sqlite3)" -a "$(sqlite3 $NIX_STATE_DIR/db/db.sqlite 'select count(*) from Refs')" -ne 0 ]; then
     echo "referrers not cleaned up"
     exit 1
 fi
diff --git a/tests/remote-store.sh b/tests/remote-store.sh
index b3908717a40e..f2f2806d022d 100644
--- a/tests/remote-store.sh
+++ b/tests/remote-store.sh
@@ -4,7 +4,7 @@ clearStore
 
 startDaemon
 
-$SHELL ./user-envs.sh
+storeCleared=1 $SHELL ./user-envs.sh
 
 nix-store --dump-db > $TEST_ROOT/d1
 NIX_REMOTE= nix-store --dump-db > $TEST_ROOT/d2
diff --git a/tests/user-envs.sh b/tests/user-envs.sh
index 526c1267cefe..c4192fdc59b2 100644
--- a/tests/user-envs.sh
+++ b/tests/user-envs.sh
@@ -1,6 +1,9 @@
 source common.sh
 
-clearStore
+if [ -z "$storeCleared" ]; then
+    clearStore
+fi
+
 clearProfiles
 
 # Query installed: should be empty.