aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-02-01 17:12:11 +0100
committerRobert Hensing <robert@roberthensing.nl>2023-04-07 16:24:18 +0200
commita58be394769fb174ee4b6ff5ce16744cf5806485 (patch)
tree45cd9685c6958acba4a7a4c3a805662c525f6c3a /src
parent969307671500cb6cb9c01ab91c1d815ebd6a644b (diff)
Move sodium_init() to initLibStore()
Part of an effort to make it easier to initialize the right things, by moving code into the appropriate libraries.
Diffstat (limited to 'src')
-rw-r--r--src/libmain/shared.cc5
-rw-r--r--src/libstore/globals.cc5
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 5e19bddb7..8e693fd8d 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -28,8 +28,6 @@
#include <openssl/crypto.h>
-#include <sodium.h>
-
namespace nix {
@@ -164,9 +162,6 @@ void initNix()
initLibUtil();
initLibStore();
- if (sodium_init() == -1)
- throw Error("could not initialise libsodium");
-
startSignalHandlerThread();
/* Reset SIGCHLD to its default. */
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index b18525dd7..1e66838c5 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -13,6 +13,8 @@
#include <nlohmann/json.hpp>
+#include <sodium/core.h>
+
namespace nix {
@@ -292,6 +294,9 @@ void assertLibStoreInitialized() {
void initLibStore() {
+ if (sodium_init() == -1)
+ throw Error("could not initialise libsodium");
+
loadConfFile();
initLibStoreDone = true;