1{ stdenv, lib, fetchFromGitHub, openssl, tcl, installShellFiles, buildPackages, readline, ncurses, zlib, sqlite }:
2
3stdenv.mkDerivation rec {
4 pname = "sqlcipher";
5 version = "4.5.2";
6
7 src = fetchFromGitHub {
8 owner = "sqlcipher";
9 repo = "sqlcipher";
10 rev = "v${version}";
11 sha256 = "sha256-EUm4akVWUiK8U6Je1uWMo8KLQLsk57kOFCCU5Uajjt8=";
12 };
13
14 nativeBuildInputs = [ installShellFiles tcl ];
15 buildInputs = [ readline ncurses openssl zlib ];
16 depsBuildBuild = [ buildPackages.stdenv.cc ];
17
18 configureFlags = [
19 "--enable-threadsafe"
20 "--with-readline-inc=-I${lib.getDev readline}/include"
21 ];
22
23 CFLAGS = [
24 # We want feature parity with sqlite
25 sqlite.NIX_CFLAGS_COMPILE
26 "-DSQLITE_HAS_CODEC"
27 ];
28
29 BUILD_CC = "$(CC_FOR_BUILD)";
30
31 TCLLIBDIR = "${placeholder "out"}/lib/tcl${lib.versions.majorMinor tcl.version}";
32
33 postInstall = ''
34 installManPage sqlcipher.1
35 '';
36
37 meta = with lib; {
38 homepage = "https://www.zetetic.net/sqlcipher/";
39 description = "SQLite extension that provides 256 bit AES encryption of database files";
40 platforms = platforms.unix;
41 license = licenses.bsd3;
42 };
43}