nixpkgs/pkgs/tools/filesystems/cryfs/default.nix

80 lines
2.3 KiB
Nix
Raw Normal View History

2017-10-12 06:41:05 +02:00
{ stdenv, fetchFromGitHub
, cmake, pkgconfig, coreutils
, boost, cryptopp, curl, fuse, openssl, python, spdlog
}:
stdenv.mkDerivation rec {
name = "cryfs-${version}";
2018-02-06 17:28:52 +01:00
version = "0.9.9";
2017-10-12 06:41:05 +02:00
src = fetchFromGitHub {
owner = "cryfs";
repo = "cryfs";
rev = "${version}";
2018-02-06 17:28:52 +01:00
sha256 = "07f2k2b595m3vkwwlmlc0m7px0nwrrzrph3z6sss9354m0b0lcri";
2017-10-12 06:41:05 +02:00
};
prePatch = ''
patchShebangs src
substituteInPlace vendor/scrypt/CMakeLists.txt \
--replace /usr/bin/ ""
# scrypt in nixpkgs only produces a binary so we lift the patching from that so allow
# building the vendored version. This is very much NOT DRY.
# The proper solution is to have scrypt generate a dev output with the required files and just symlink
# into vendor/scrypt
for f in Makefile.in autocrap/Makefile.am libcperciva/cpusupport/Build/cpusupport.sh ; do
substituteInPlace vendor/scrypt/scrypt-*/scrypt/$f --replace "command -p " ""
done
# cryfs is vendoring an old version of spdlog
rm -rf vendor/spdlog/spdlog
ln -s ${spdlog} vendor/spdlog/spdlog
'';
buildInputs = [ boost cryptopp curl fuse openssl python spdlog ];
2017-10-13 17:29:20 +02:00
patches = [
./test-no-network.patch # Disable tests using external networking
./skip-failing-test-large-malloc.patch
];
2017-10-12 06:41:05 +02:00
# coreutils is needed for the vendored scrypt
nativeBuildInputs = [ cmake coreutils pkgconfig ];
enableParallelBuilding = true;
cmakeFlags = [
"-DCRYFS_UPDATE_CHECKS=OFF"
"-DBoost_USE_STATIC_LIBS=OFF" # this option is case sensitive
2017-10-13 17:29:20 +02:00
"-DBUILD_TESTING=ON"
2017-10-12 06:41:05 +02:00
];
2017-10-13 17:29:20 +02:00
doCheck = true;
# Cryfs tests are broken on darwin
checkPhase = stdenv.lib.optionalString (!stdenv.isDarwin) ''
# Skip CMakeFiles directory and tests depending on fuse (does not work well with sandboxing)
SKIP_IMPURE_TESTS="CMakeFiles|fspp|cryfs-cli"
for test in `ls -d test/*/ | egrep -v "$SKIP_IMPURE_TESTS"`; do
"./$test`basename $test`-test"
done
'';
installPhase = ''
# Building with BUILD_TESTING=ON is missing the install target
mkdir -p $out/bin
install -m 755 ./src/cryfs-cli/cryfs $out/bin/cryfs
'';
2017-10-12 06:41:05 +02:00
meta = with stdenv.lib; {
description = "Cryptographic filesystem for the cloud";
homepage = https://www.cryfs.org;
license = licenses.lgpl3;
maintainers = with maintainers; [ peterhoeg ];
platforms = with platforms; linux;
};
}