1{ lib, stdenv, fetchFromGitHub
2, cmake, pkg-config, python3
3, boost175, curl, fuse, openssl, range-v3, spdlog
4# cryptopp and gtest on standby - using the vendored ones for now
5# see https://github.com/cryfs/cryfs/issues/369
6, llvmPackages
7}:
8
9stdenv.mkDerivation rec {
10 pname = "cryfs";
11 version = "0.11.3";
12
13 src = fetchFromGitHub {
14 owner = pname;
15 repo = pname;
16 rev = version;
17 hash = "sha256-7luTCDjrquG8aBZ841VPwV9/ea8faHGLQtmRahqGTss=";
18 };
19
20 postPatch = ''
21 patchShebangs src
22
23 # remove tests that require network access
24 substituteInPlace test/cpp-utils/CMakeLists.txt \
25 --replace "network/CurlHttpClientTest.cpp" "" \
26 --replace "network/FakeHttpClientTest.cpp" ""
27
28 # remove CLI test trying to access /dev/fuse
29 substituteInPlace test/cryfs-cli/CMakeLists.txt \
30 --replace "CliTest_IntegrityCheck.cpp" "" \
31 --replace "CliTest_Setup.cpp" "" \
32 --replace "CliTest_WrongEnvironment.cpp" "" \
33 --replace "CryfsUnmountTest.cpp" ""
34
35 # downsize large file test as 4.5G is too big for Hydra
36 substituteInPlace test/cpp-utils/data/DataTest.cpp \
37 --replace "(4.5L*1024*1024*1024)" "(0.5L*1024*1024*1024)"
38 '';
39
40 nativeBuildInputs = [ cmake pkg-config python3 ];
41
42 strictDeps = true;
43
44 buildInputs = [ boost175 curl fuse openssl range-v3 spdlog ]
45 ++ lib.optional stdenv.cc.isClang llvmPackages.openmp;
46
47 #nativeCheckInputs = [ gtest ];
48
49 cmakeFlags = [
50 "-DDEPENDENCY_CONFIG='../cmake-utils/DependenciesFromLocalSystem.cmake'"
51 "-DCRYFS_UPDATE_CHECKS:BOOL=FALSE"
52 "-DBoost_USE_STATIC_LIBS:BOOL=FALSE" # this option is case sensitive
53 "-DBUILD_TESTING:BOOL=${if doCheck then "TRUE" else "FALSE"}"
54 ]; # ++ lib.optional doCheck "-DCMAKE_PREFIX_PATH=${gtest.dev}/lib/cmake";
55
56 # macFUSE needs to be installed for the test to succeed on Darwin
57 doCheck = !stdenv.isDarwin;
58
59 checkPhase = ''
60 runHook preCheck
61 export HOME=$(mktemp -d)
62
63 # Skip CMakeFiles directory and tests depending on fuse (does not work well with sandboxing)
64 SKIP_IMPURE_TESTS="CMakeFiles|fspp|my-gtest-main"
65
66 for t in $(ls -d test/*/ | grep -E -v "$SKIP_IMPURE_TESTS") ; do
67 "./$t$(basename $t)-test"
68 done
69
70 runHook postCheck
71 '';
72
73 meta = with lib; {
74 description = "Cryptographic filesystem for the cloud";
75 homepage = "https://www.cryfs.org/";
76 changelog = "https://github.com/cryfs/cryfs/raw/${version}/ChangeLog.txt";
77 license = licenses.lgpl3Only;
78 maintainers = with maintainers; [ peterhoeg c0bw3b ];
79 platforms = platforms.unix;
80 };
81}