1{ stdenv, fetchFromGitHub, pkgconfig, nettools, gettext, libtool, flex
2, readline ? null, openssl ? null, python ? null, ncurses ? null
3, sqlite ? null, postgresql ? null, libmysql ? null, zlib ? null, lzo ? null
4, jansson ? null, acl ? null, glusterfs ? null, libceph ? null, libcap ? null
5}:
6
7assert sqlite != null || postgresql != null || libmysql != null;
8
9with stdenv.lib;
10let
11 withGlusterfs = "\${with_glusterfs_directory}";
12in
13stdenv.mkDerivation rec {
14 name = "bareos-${version}";
15 version = "15.2.1";
16
17 src = fetchFromGitHub {
18 owner = "bareos";
19 repo = "bareos";
20 rev = "Release/${version}";
21 name = "${name}-src";
22 sha256 = "01vnqahzjj598jjk4y7qzfnq415jh227v40sgkrdl4qcpn76spxi";
23 };
24
25 nativeBuildInputs = [ pkgconfig ];
26 buildInputs = [
27 nettools gettext readline openssl python flex ncurses sqlite postgresql
28 libmysql zlib lzo jansson acl glusterfs libceph libcap
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=/var/run/bareos"
46 "--with-subsys-dir=/var/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}" ]
54 ++ optional (python != null) "--with-python=${python}"
55 ++ optional (openssl != null) "--with-openssl=${openssl}"
56 ++ optional (sqlite != null) "--with-sqlite3=${sqlite}"
57 ++ optional (postgresql != null) "--with-postgresql=${postgresql}"
58 ++ optional (libmysql != null) "--with-mysql=${libmysql}"
59 ++ optional (zlib != null) "--with-zlib=${zlib}"
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 stdenv.lib; {
76 homepage = http://www.bareos.org/;
77 description = "A fork of the bacula project";
78 license = licenses.agpl3;
79 platforms = platforms.unix;
80 maintainers = with maintainers; [ wkennington ];
81 };
82}