1{
2 lib,
3 stdenv,
4 fetchurl,
5 autoreconfHook,
6 testers,
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "libsodium";
11 version = "1.0.20";
12
13 src = fetchurl {
14 url = "https://download.libsodium.org/libsodium/releases/libsodium-${finalAttrs.version}.tar.gz";
15 hash = "sha256-67Ze9spDkzPCu0GgwZkFhyiNoH9sf9B8s6GMwY0wzhk=";
16 };
17
18 outputs = [
19 "out"
20 "dev"
21 ];
22
23 nativeBuildInputs = [ autoreconfHook ];
24
25 separateDebugInfo = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "musl";
26
27 enableParallelBuilding = true;
28 hardeningDisable = lib.optional (
29 stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isx86_32
30 ) "stackprotector";
31
32 # FIXME: the hardeingDisable attr above does not seems effective, so
33 # the need to disable stackprotector via configureFlags
34 configureFlags = lib.optional (
35 stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isx86_32
36 ) "--disable-ssp";
37
38 doCheck = true;
39
40 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
41
42 meta = with lib; {
43 description = "Modern and easy-to-use crypto library";
44 homepage = "https://doc.libsodium.org/";
45 license = licenses.isc;
46 maintainers = with maintainers; [ raskin ];
47 pkgConfigModules = [ "libsodium" ];
48 platforms = platforms.all;
49 };
50})