3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/filesystems/cryfs/default.nix

85 lines
2.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, fetchpatch
2021-03-25 11:12:49 +00:00
, cmake, pkg-config, python3, gtest
2019-11-29 21:58:38 +00:00
, boost, cryptopp, curl, fuse, openssl
2017-10-12 05:41:05 +01:00
}:
stdenv.mkDerivation rec {
pname = "cryfs";
2019-11-29 21:58:38 +00:00
version = "0.10.2";
2017-10-12 05:41:05 +01:00
src = fetchFromGitHub {
owner = "cryfs";
repo = "cryfs";
2019-09-09 00:38:31 +01:00
rev = version;
2019-11-29 21:58:38 +00:00
sha256 = "1m6rcc82hbaiwcwcvf5xmxma8n0jal9zhcykv9xgwiax4ny0l8kz";
2017-10-12 05:41:05 +01:00
};
2019-11-29 21:58:38 +00:00
patches = [
(fetchpatch {
name = "cryfs-0.10.2-install-targets.patch";
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/cryfs/files/cryfs-0.10.2-install-targets.patch?id=192ac7421ddd4093125f4997898fb62e8a140a44";
sha256 = "1jz6gpi1i7dnfm88a6n3mccwfmsmvg0d0bmp3fmqqrkbcg7in00l";
})
(fetchpatch {
name = "cryfs-0.10.2-unbundle-libs.patch";
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-fs/cryfs/files/cryfs-0.10.2-unbundle-libs.patch?id=192ac7421ddd4093125f4997898fb62e8a140a44";
sha256 = "0hzss5rawcjrh8iqzc40w5yjhxdqya4gbg6dzap70180s50mahzs";
})
2021-03-25 16:34:10 +00:00
# Backported from https://github.com/cryfs/cryfs/pull/378
./use-macfuse.patch
2019-11-29 21:58:38 +00:00
];
postPatch = ''
2017-10-12 05:41:05 +01:00
patchShebangs src
2019-11-29 21:58:38 +00:00
# remove tests that require network access:
substituteInPlace test/cpp-utils/CMakeLists.txt \
--replace "network/CurlHttpClientTest.cpp" "" \
--replace "network/FakeHttpClientTest.cpp" ""
2017-10-12 05:41:05 +01:00
2019-11-29 21:58:38 +00:00
# remove CLI test trying to access /dev/fuse
substituteInPlace test/cryfs-cli/CMakeLists.txt \
--replace "CliTest_IntegrityCheck.cpp" ""
2017-10-12 05:41:05 +01:00
2019-11-29 21:58:38 +00:00
# downsize large file test as 4.5G is too big for Hydra:
substituteInPlace test/cpp-utils/data/DataTest.cpp \
--replace "(4.5L*1024*1024*1024)" "(0.5L*1024*1024*1024)"
2017-10-12 05:41:05 +01:00
'';
2021-03-25 11:12:49 +00:00
nativeBuildInputs = [ cmake pkg-config python3 ];
2017-10-12 05:41:05 +01:00
2021-03-25 11:12:49 +00:00
strictDeps = true;
2021-03-25 16:34:10 +00:00
buildInputs = [ boost cryptopp curl fuse openssl ];
checkInputs = [ gtest ];
2017-10-12 05:41:05 +01:00
cmakeFlags = [
2019-11-29 21:58:38 +00:00
"-DCRYFS_UPDATE_CHECKS:BOOL=FALSE"
"-DBoost_USE_STATIC_LIBS:BOOL=FALSE" # this option is case sensitive
"-DUSE_SYSTEM_LIBS:BOOL=TRUE"
2021-03-25 16:34:10 +00:00
"-DBUILD_TESTING:BOOL=${if doCheck then "TRUE" else "FALSE"}"
] ++ lib.optional doCheck "-DCMAKE_PREFIX_PATH=${gtest.dev}/lib/cmake";
2017-10-12 05:41:05 +01:00
# macFUSE needs to be installed for the test to succeed on Darwin
doCheck = !stdenv.isDarwin;
2017-10-13 16:29:20 +01:00
2019-11-29 21:58:38 +00:00
checkPhase = ''
2017-10-13 16:29:20 +01:00
# Skip CMakeFiles directory and tests depending on fuse (does not work well with sandboxing)
2019-11-29 21:58:38 +00:00
SKIP_IMPURE_TESTS="CMakeFiles|fspp|my-gtest-main"
2017-10-13 16:29:20 +01:00
2019-11-29 21:58:38 +00:00
for t in $(ls -d test/*/ | egrep -v "$SKIP_IMPURE_TESTS"); do
"./$t$(basename $t)-test"
2017-10-13 16:29:20 +01:00
done
'';
meta = with lib; {
2017-10-12 05:41:05 +01:00
description = "Cryptographic filesystem for the cloud";
homepage = "https://www.cryfs.org";
2017-10-12 05:41:05 +01:00
license = licenses.lgpl3;
2019-11-29 21:58:38 +00:00
maintainers = with maintainers; [ peterhoeg c0bw3b ];
2021-03-25 16:34:10 +00:00
platforms = platforms.unix;
2017-10-12 05:41:05 +01:00
};
}