cjdns: use system libsodium

This commit is contained in:
Yureka 2023-03-18 19:03:42 +01:00
parent 5ce282e57e
commit 34aef860a5
2 changed files with 41 additions and 0 deletions

View file

@ -8,6 +8,9 @@
, libuv
, util-linux
, nixosTests
, libsodium
, pkg-config
, substituteAll
}:
rustPlatform.buildRustPackage rec {
@ -21,20 +24,30 @@ rustPlatform.buildRustPackage rec {
sha256 = "sha256-vI3uHZwmbFqxGasKqgCl0PLEEO8RNEhwkn5ZA8K7bxU=";
};
patches = [
(substituteAll {
src = ./system-libsodium.patch;
libsodium_include_dir = "${libsodium.dev}/include";
})
];
cargoSha256 = "sha256-x3LxGOhGXrheqdke0eYiQVo/IqgWgcDrDNupdLjRPjA=";
nativeBuildInputs = [
which
python39
nodejs
pkg-config
] ++
# for flock
lib.optional stdenv.isLinux util-linux;
buildInputs = [
libuv
libsodium
];
env.SODIUM_USE_PKG_CONFIG = 1;
env.NIX_CFLAGS_COMPILE = toString ([
"-O2"
"-Wno-error=array-bounds"

View file

@ -0,0 +1,28 @@
diff --git a/node_build/make.js b/node_build/make.js
index 1d0b0fa..b640f31 100644
--- a/node_build/make.js
+++ b/node_build/make.js
@@ -254,21 +254,8 @@ Builder.configure({
}).nThen(function (waitFor) {
- const dir = `${builder.config.buildDir}/../..`;
- Fs.readdir(dir, waitFor((err, ret) => {
- if (err) { throw err; }
- ret.forEach((f) => {
- if (!/^libsodium-sys-/.test(f)) { return; }
- const inclPath = `${dir}/${f}/out/source/libsodium/src/libsodium/include`;
- Fs.readdir(inclPath, waitFor((err, ret) => {
- if (foundSodium) { return; }
- if (err && err.code === 'ENOENT') { return; }
- if (err) { throw err; }
- builder.config.includeDirs.push(inclPath);
- foundSodium = true;
- }));
- });
- }));
+ builder.config.includeDirs.push("@libsodium_include_dir@");
+ foundSodium = true;
}).nThen(function (waitFor) {