summary refs log tree commit diff
path: root/nix/guix-register/guix-register.cc
diff options
context:
space:
mode:
Diffstat (limited to 'nix/guix-register/guix-register.cc')
-rw-r--r--nix/guix-register/guix-register.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/nix/guix-register/guix-register.cc b/nix/guix-register/guix-register.cc
index 4aee4fde34..ed5ab23e41 100644
--- a/nix/guix-register/guix-register.cc
+++ b/nix/guix-register/guix-register.cc
@@ -56,10 +56,14 @@ from an existing store.  It updates the new store's database with \
 information about which store files are valid, and what their \
 references are.";
 
+#define GUIX_OPT_STATE_DIRECTORY 1
+
 static const struct argp_option options[] =
   {
     { "prefix", 'p', "DIRECTORY", 0,
       "Open the store that lies under DIRECTORY" },
+    { "state-directory", GUIX_OPT_STATE_DIRECTORY, "DIRECTORY", 0,
+      "Use DIRECTORY as the state directory of the target store" },
     { 0, 0, 0, 0, 0 }
   };
 
@@ -84,6 +88,15 @@ parse_opt (int key, char *arg, struct argp_state *state)
 	break;
       }
 
+    case GUIX_OPT_STATE_DIRECTORY:
+      {
+	string state_dir = canonPath (arg);
+
+	settings.nixStateDir = state_dir;
+	settings.nixDBPath = state_dir + "/db";
+	break;
+      }
+
     case ARGP_KEY_ARG:
       {
 	std::ifstream *file;