1{ lib, stdenv, fetchurl, sqlite, postgresql, zlib, acl, ncurses, openssl, readline
2, CoreFoundation, IOKit
3}:
4
5stdenv.mkDerivation rec {
6 pname = "bacula";
7 version = "13.0.3";
8
9 src = fetchurl {
10 url = "mirror://sourceforge/bacula/${pname}-${version}.tar.gz";
11 sha256 = "sha256-CUnDK+EJBYXojkwB2CgALodgMTbYfFmKKd/0K7PtKkA=";
12 };
13
14 # libtool.m4 only matches macOS 10.*
15 postPatch = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
16 substituteInPlace configure \
17 --replace "10.*)" "*)"
18 '';
19
20 buildInputs = [ postgresql sqlite zlib ncurses openssl readline ]
21 ++ lib.optionals stdenv.hostPlatform.isDarwin [
22 CoreFoundation
23 IOKit
24 ]
25 # acl relies on attr, which I can't get to build on darwin
26 ++ lib.optional (!stdenv.isDarwin) acl;
27
28 configureFlags = [
29 "--with-sqlite3=${sqlite.dev}"
30 "--with-postgresql=${postgresql}"
31 "--with-logdir=/var/log/bacula"
32 "--with-working-dir=/var/lib/bacula"
33 "--mandir=\${out}/share/man"
34 ] ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "ac_cv_func_setpgrp_void=yes";
35
36 installFlags = [
37 "logdir=\${out}/logdir"
38 "working_dir=\${out}/workdir"
39 ];
40
41 postInstall = ''
42 mkdir -p $out/bin
43 ln -s $out/sbin/* $out/bin
44 '';
45
46 meta = with lib; {
47 description = "Enterprise ready, Network Backup Tool";
48 homepage = "http://bacula.org/";
49 license = with licenses; [ agpl3Only bsd2 ];
50 maintainers = with maintainers; [ lovek323 eleanor ];
51 platforms = platforms.all;
52 };
53}