summary refs log tree commit diff
path: root/pkgs/tools/backup/bareos/default.nix
blob: 016e3c5d51e8c1ed73548bed0fe0cf4341fb7c4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ stdenv, fetchFromGitHub, pkgconfig, nettools, gettext, libtool
, readline ? null, openssl ? null, python ? null, ncurses ? null
, sqlite ? null, postgresql ? null, libmysql ? null, zlib ? null, lzo ? null
, acl ? null, glusterfs ? null, libceph ? null, libcap ? null
}:

assert sqlite != null || postgresql != null || libmysql != null;

with stdenv.lib;
let
  withGlusterfs = "\${with_glusterfs_directory}";
in
stdenv.mkDerivation rec {
  name = "bareos-${version}";
  version = "14.2.4";

  src = fetchFromGitHub {
    owner = "bareos";
    repo = "bareos";
    rev = "Release/${version}";
    name = "${name}-src";
    sha256 = "0shb91pawdgrn6rb4np3zyyxv36899nvwf8jaihkg0wvb01viqzr";
  };

  buildInputs = [
    pkgconfig nettools gettext readline openssl python
    ncurses sqlite postgresql libmysql zlib lzo acl glusterfs libceph libcap
  ];

  postPatch = ''
    sed -i 's,\(-I${withGlusterfs}/include\),\1/glusterfs,' configure
  '';

  configureFlags = [
    "--sysconfdir=/etc"
    "--exec-prefix=\${out}"
    "--enable-lockmgr"
    "--enable-dynamic-storage-backends"
    "--with-basename=nixos" # For reproducible builds since it uses the hostname otherwise
    "--with-hostname=nixos" # For reproducible builds since it uses the hostname otherwise
    "--with-working-dir=/var/lib/bareos"
    "--with-bsrdir=/var/lib/bareos"
    "--with-logdir=/var/log/bareos"
    "--with-pid-dir=/var/run/bareos"
    "--with-subsys-dir=/var/run/bareos"
    "--enable-ndmp"
    "--enable-lmdb"
    "--enable-batch-insert"
    "--enable-dynamic-cats-backends"
    "--enable-sql-pooling"
    "--enable-scsi-crypto"
  ] ++ optionals (readline != null) [ "--disable-conio" "--enable-readline" "--with-readline=${readline}" ]
    ++ optional (python != null) "--with-python=${python}"
    ++ optional (openssl != null) "--with-openssl=${openssl}"
    ++ optional (sqlite != null) "--with-sqlite3=${sqlite}"
    ++ optional (postgresql != null) "--with-postgresql=${postgresql}"
    ++ optional (libmysql != null) "--with-mysql=${libmysql}"
    ++ optional (zlib != null) "--with-zlib=${zlib}"
    ++ optional (lzo != null) "--with-lzo=${lzo}"
    ++ optional (acl != null) "--enable-acl"
    ++ optional (glusterfs != null) "--with-glusterfs=${glusterfs}"
    ++ optional (libceph != null) "--with-cephfs=${libceph}";

  installFlags = [
    "sysconfdir=\${out}/etc"
    "working_dir=\${TMPDIR}"
    "log_dir=\${TMPDIR}"
  ];

  meta = with stdenv.lib; {
    homepage = http://www.bareos.org/;
    description = "A fork of the bacula project";
    license = licenses.agpl3;
    platforms = platforms.unix;
    maintainers = with maintainers; [ wkennington ];
  };
}