* nix/guix-register/guix-register.cc (register_validity): Leave
'info.path' unmodified when PREFIX is empty.
(main): Call 'settings.processEnvironment' early on.
Leave 'settings.nixStore' unmodified when PREFIX is empty.
Before that, calls to 'HashSink::currentHash()' would eventually lead to
a segfault because the underlying gcrypt handle has been closed. (Note
that this method is only used via 'importPaths' and 'exportPath', though.)
* nix/libutil/gcrypt-hash.hh (struct guix_hash_context): Add a
constructor and a copy constructor; move out of 'extern "C"'.
* nix/libutil/gcrypt-hash.cc (guix_hash_final): Clear 'md_handle' upon
exit.
* nix/sync-with-upstream (top_srcdir): Change hash.{cc,hh} to read
'struct Ctx' instead of 'union Ctx'.
Inspired by <772b70952f...4ddd077bfa>.
* nix/scripts/list-runtime-roots.in (%store-directory): New variable.
(proc-environ-roots): New procedure.
(<top-level>): Use it.
This fixes a bug whereby 'guix-register' would bail out when trying to
create NIX_STORE_DIR/.links when NIX_STORE_DIR is read-only.
* nix/guix-register/guix-register.cc (parse_opt): Initialize
'settings.nixStore' to PREFIX + NIX_STORE_DIR.
(main): Change 'settings.nixStore' once the 'LocalStore' has been
instantiated.
* nix/guix-register/guix-register.cc (prefix): New variable.
(parse_opt): Use it.
(register_validity): Change 'info.path' to the final store name.
Hash the final under its real path.
* tests/guix-register.sh: Adjust the contents of $closure accordingly.
Rename 'NIX_LOCALSTATE_DIR' to 'NIX_STATE_DIR'. Don't try to call
'valid-path?'. Add test using 'sqlite3'.
Fixes compilation with the forthcoming libgcrypt 1.6.x.
Reported by Matthias Wachs <wachs@net.in.tum.de>
and NIIBE Yutaka <gniibe@fsij.org>.
* nix/libutil/gcrypt-hash.cc (guix_hash_init, guix_hash_final): Use
'int' as the type of the 'algo' parameter.
* nix/libutil/gcrypt-hash.hh: Update declarations accordingly.
Suggested by Mark H. Weaver.
* nix/nix-daemon/guix-daemon.cc (GUIX_OPT_NO_SUBSTITUTES): New macro.
(options): Add `--no-substitutes'.
(parse_opt): Add `GUIX_OPT_NO_SUBSTITUTES' case.
(main): Leave `settings.substituters' empty when
`settings.useSubstitutes' is false.
* guix/scripts/substitute-binary.scm: New file.
* Makefile.am (MODULES): Add it.
* nix/scripts/substitute-binary.in: New file.
* config-daemon.ac: Produce nix/scripts/substitute-binary.
* daemon.am (nodist_pkglibexec_SCRIPTS): Add
nix/scripts/substitute-binary.
* guix/store.scm (substitutable-path-info): Use the
`query-substitutable-path-infos' RPC.
* nix/nix-daemon/guix-daemon.cc (main): Honor `NIX_SUBSTITUTERS'.
* pre-inst-env.in: Set `NIX_SUBSTITUTERS'.
* test-env.in: Leave `NIX_SUBSTITUTERS' unchanged. Set
`GUIX_BINARY_SUBSTITUTE_URL, and create
$NIX_STATE_DIR/substituter-data.
Run `guix-daemon' within `./pre-inst-env'.
* tests/store.scm ("substitute query"): New test.
* nix/scripts/list-runtime-roots.in: New file.
* config-daemon.ac: Add `AC_CONFIG_FILES' invocation for it.
* daemon.am (nodist_pkglibexec_SCRIPTS): New variable.
(AM_TESTS_ENVIRONMENT): Define `top_builddir'.
* tests/guix-daemon.sh: Export `NIX_ROOT_FINDER'.
* nix/sync-with-upstream: Substitute the path to the root finder in
libstore/gc.cc.
* nix/nix-daemon/guix-daemon.cc (options)[!HAVE_CHROOT]: Mention that
`--disable-chroot' has no effect.
(main)[!HAVE_CHROOT]: Set `useChroot' to false.
* nix/libutil/md5.h (MD5_Final): Pass RESBUF as the first argument to
`guix_hash_final'.
* nix/libutil/sha1.h (SHA1_Final): Likewise.
* nix/libutil/sha256.h (SHA256_Final): Likewise.