summaryrefslogtreecommitdiff
path: root/guix/store.scm
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 /guix/store.scm
parent1c00f83650d9412f140cce6766753a611330d6f1 (diff)
downloadgnu-guix-689142cd759457f375230a00dc719ddc00dc2fe4.tar
gnu-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 'guix/store.scm')
-rw-r--r--guix/store.scm16
1 files changed, 11 insertions, 5 deletions
diff --git a/guix/store.scm b/guix/store.scm
index 8c774a6db2..79dcf22cca 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -797,11 +797,14 @@ signing them if SIGN? is true."
(loop tail)))))))
(define* (register-path path
- #:key (references '()) deriver prefix)
+ #:key (references '()) deriver prefix
+ state-directory)
"Register PATH as a valid store file, with REFERENCES as its list of
references, and DERIVER as its deriver (.drv that led to it.) If PREFIX is
not #f, it must be the name of the directory containing the new store to
-initialize. Return #t on success.
+initialize; if STATE-DIRECTORY is not #f, it must be a string containing the
+absolute file name to the state directory of the store being initialized.
+Return #t on success.
Use with care as it directly modifies the store! This is primarily meant to
be used internally by the daemon's build hook."
@@ -809,9 +812,12 @@ be used internally by the daemon's build hook."
(catch 'system-error
(lambda ()
(let ((pipe (apply open-pipe* OPEN_WRITE %guix-register-program
- (if prefix
- `("--prefix" ,prefix)
- '()))))
+ `(,@(if prefix
+ `("--prefix" ,prefix)
+ '())
+ ,@(if state-directory
+ `("--state-directory" ,state-directory)
+ '())))))
(and pipe
(begin
(format pipe "~a~%~a~%~a~%"