aboutsummaryrefslogtreecommitdiff
path: root/nix/guix-register
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-18 11:03:50 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-18 20:40:51 +0200
commit689142cd759457f375230a00dc719ddc00dc2fe4 (patch)
treed605e372177e1a2f3c895d5cfb86c401d3a1de38 /nix/guix-register
parent1c00f83650d9412f140cce6766753a611330d6f1 (diff)
downloadguix-689142cd759457f375230a00dc719ddc00dc2fe4.tar
guix-689142cd759457f375230a00dc719ddc00dc2fe4.tar.gz
guix-register: Add '--state-directory' parameter.
* nix/guix-register/guix-register.cc (GUIX_OPT_STATE_DIRECTORY): New macro. (parse_opt): Honor it. * tests/guix-register.sh: Add test with '--state-directory'. * guix/store.scm (register-path): Add #:state-directory parameter.
Diffstat (limited to 'nix/guix-register')
-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;