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