summary refs log tree commit diff
path: root/pkgs/applications/backup/deja-dup/default.nix
blob: 4d3a9a385d648598d8910239c18135cd6bcacc93 (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
78
79
80
81
82
83
{ stdenv, fetchurl, meson, ninja, pkgconfig, vala_0_38, gettext
, gnome3, libnotify, intltool, itstool, glib, gtk3, libxml2
, coreutils, libsecret, pcre, libxkbcommon, wrapGAppsHook
, libpthreadstubs, libXdmcp, epoxy, at_spi2_core, dbus, libgpgerror
, appstream-glib, desktop_file_utils, atk, pango, duplicity
}:

stdenv.mkDerivation rec {
  name = "deja-dup-${version}";
  version = "36.1";

  src = fetchurl {
    url = "https://launchpad.net/deja-dup/36/${version}/+download/deja-dup-${version}.tar.xz";
    sha256 = "1s48k2sxrpwkzp37s4x7934lyg5194c47nv9ks15rksd5s0alnld";
  };

  patches = [
    ./fix-paths.patch
  ];

  postPatch = ''
    substituteInPlace libdeja/tools/duplicity/DuplicityInstance.vala --replace \
      "/bin/rm" \
      "${coreutils}/bin/rm"
  '';

  # couldn't find gio/gdesktopappinfo.h
  NIX_CFLAGS_COMPILE = "-I${glib.dev}/include/gio-unix-2.0";

  nativeBuildInputs = [
    meson ninja pkgconfig vala_0_38 gettext intltool itstool
    appstream-glib desktop_file_utils libxml2 wrapGAppsHook
  ];

  buildInputs = [
   libnotify gnome3.libpeas glib gtk3 libsecret
   pcre libxkbcommon libpthreadstubs libXdmcp epoxy gnome3.nautilus
   at_spi2_core dbus gnome3.gnome_online_accounts libgpgerror
  ];

  propagatedUserEnvPkgs = [ duplicity ];

  postInstall = ''
    glib-compile-schemas $out/share/glib-2.0/schemas
  '';

  # Manual rpath definition until https://github.com/mesonbuild/meson/issues/314 is fixed
  postFixup =
    let
      rpath = stdenv.lib.makeLibraryPath [
        glib
        gtk3
        gnome3.gnome_online_accounts
        gnome3.libpeas
        gnome3.nautilus
        libgpgerror
        libsecret
        # Transitive
        atk
        pango
      ];
    in ''
      # Unwrap accidentally wrapped library
      mv $out/libexec/deja-dup/tools/.libduplicity.so-wrapped $out/libexec/deja-dup/tools/libduplicity.so

      for elf in "$out"/bin/.*-wrapped "$out"/libexec/deja-dup/.deja-dup-monitor-wrapped "$out"/libexec/deja-dup/tools/*.so "$out"/lib/deja-dup/*.so "$out"/lib/nautilus/extensions-3.0/*.so; do
        patchelf --set-rpath '${rpath}':"$out/lib/deja-dup" "$elf"
      done
    '';

  meta = with stdenv.lib; {
    description = "A simple backup tool";
    longDescription = ''
      Déjà Dup is a simple backup tool. It hides the complexity \
      of backing up the Right Way (encrypted, off-site, and regular) \
      and uses duplicity as the backend.
    '';
    homepage = https://launchpad.net/deja-dup;
    license = with licenses; gpl3;
    maintainers = with maintainers; [ jtojnar ];
    platforms = with platforms; linux;
  };
}