1{ lib, stdenv, fetchFromGitHub, pkg-config, nettools, gettext, flex
2, readline ? null, openssl ? null, python2 ? null, ncurses ? null, rocksdb
3, sqlite ? null, postgresql ? null, libmysqlclient ? null, zlib ? null, lzo ? null
4, jansson ? null, acl ? null, glusterfs ? null, libceph ? null, libcap ? null
5}:
6
7assert sqlite != null || postgresql != null || libmysqlclient != null;
8
9with lib;
10let
11 withGlusterfs = "\${with_glusterfs_directory}";
12in
13stdenv.mkDerivation rec {
14 pname = "bareos";
15 version = "17.2.7";
16
17 src = fetchFromGitHub {
18 owner = "bareos";
19 repo = "bareos";
20 rev = "Release/${version}";
21 name = "${pname}-${version}-src";
22 sha256 = "1awf5i4mw2nfd7z0dmqnywapnx9nz6xwqv8rxp0y2mnrhzdpbrbz";
23 };
24
25 nativeBuildInputs = [ pkg-config ];
26 buildInputs = [
27 nettools gettext readline openssl python2 flex ncurses sqlite postgresql
28 libmysqlclient zlib lzo jansson acl glusterfs libceph libcap rocksdb
29 ];
30
31 postPatch = ''
32 sed -i 's,\(-I${withGlusterfs}/include\),\1/glusterfs,' configure
33 '';
34
35 configureFlags = [
36 "--sysconfdir=/etc"
37 "--exec-prefix=\${out}"
38 "--enable-lockmgr"
39 "--enable-dynamic-storage-backends"
40 "--with-basename=nixos" # For reproducible builds since it uses the hostname otherwise
41 "--with-hostname=nixos" # For reproducible builds since it uses the hostname otherwise
42 "--with-working-dir=/var/lib/bareos"
43 "--with-bsrdir=/var/lib/bareos"
44 "--with-logdir=/var/log/bareos"
45 "--with-pid-dir=/run/bareos"
46 "--with-subsys-dir=/run/bareos"
47 "--enable-ndmp"
48 "--enable-lmdb"
49 "--enable-batch-insert"
50 "--enable-dynamic-cats-backends"
51 "--enable-sql-pooling"
52 "--enable-scsi-crypto"
53 ] ++ optionals (readline != null) [ "--disable-conio" "--enable-readline" "--with-readline=${readline.dev}" ]
54 ++ optional (python2 != null) "--with-python=${python2}"
55 ++ optional (openssl != null) "--with-openssl=${openssl.dev}"
56 ++ optional (sqlite != null) "--with-sqlite3=${sqlite.dev}"
57 ++ optional (postgresql != null) "--with-postgresql=${postgresql}"
58 ++ optional (libmysqlclient != null) "--with-mysql=${libmysqlclient}"
59 ++ optional (zlib != null) "--with-zlib=${zlib.dev}"
60 ++ optional (lzo != null) "--with-lzo=${lzo}"
61 ++ optional (jansson != null) "--with-jansson=${jansson}"
62 ++ optional (acl != null) "--enable-acl"
63 ++ optional (glusterfs != null) "--with-glusterfs=${glusterfs}"
64 ++ optional (libceph != null) "--with-cephfs=${libceph}";
65
66 installFlags = [
67 "sysconfdir=\${out}/etc"
68 "confdir=\${out}/etc/bareos"
69 "scriptdir=\${out}/etc/bareos"
70 "working_dir=\${TMPDIR}"
71 "log_dir=\${TMPDIR}"
72 "sbindir=\${out}/bin"
73 ];
74
75 meta = with lib; {
76 homepage = "http://www.bareos.org/";
77 description = "A fork of the bacula project";
78 license = licenses.agpl3;
79 platforms = platforms.unix;
80 broken = true;
81 };
82}