1{ lib
2, stdenv
3, fetchFromGitHub
4, openssl
5, tcl
6, installShellFiles
7, buildPackages
8, readline
9, ncurses
10, zlib
11, sqlite
12}:
13
14stdenv.mkDerivation rec {
15 pname = "sqlcipher";
16 version = "4.5.5";
17
18 src = fetchFromGitHub {
19 owner = "sqlcipher";
20 repo = "sqlcipher";
21 rev = "v${version}";
22 hash = "sha256-amWYkVQr+Rmcj+32lFDRq43Q+Ojj8V8B6KoURqdwGt0=";
23 };
24
25 nativeBuildInputs = [
26 installShellFiles
27 tcl
28 ];
29
30 buildInputs = [
31 readline
32 ncurses
33 openssl
34 zlib
35 ];
36
37 depsBuildBuild = [
38 buildPackages.stdenv.cc
39 ];
40
41 configureFlags = [
42 "--enable-threadsafe"
43 "--with-readline-inc=-I${lib.getDev readline}/include"
44 ];
45
46 CFLAGS = [
47 # We want feature parity with sqlite
48 sqlite.NIX_CFLAGS_COMPILE
49 "-DSQLITE_HAS_CODEC"
50 ];
51
52 BUILD_CC = "$(CC_FOR_BUILD)";
53
54 TCLLIBDIR = "${placeholder "out"}/lib/tcl${lib.versions.majorMinor tcl.version}";
55
56 postInstall = ''
57 installManPage sqlcipher.1
58 '';
59
60 meta = with lib; {
61 changelog = "https://github.com/sqlcipher/sqlcipher/blob/v${version}/CHANGELOG.md";
62 description = "SQLite extension that provides 256 bit AES encryption of database files";
63 homepage = "https://www.zetetic.net/sqlcipher/";
64 license = licenses.bsd3;
65 maintainers = with maintainers; [ ];
66 platforms = platforms.unix;
67 };
68}