summary refs log tree commit diff
path: root/pkgs/applications/networking/sync/backintime/qt.nix
blob: bd571b1aed3564dfaa3e0712a26c9fdf44dde62f (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
{ lib, mkDerivation, backintime-common, python3, polkit, which, su, coreutils, util-linux }:

let
  python' = python3.withPackages (ps: with ps; [ pyqt5 backintime-common packaging ]);
in
mkDerivation {
  inherit (backintime-common)
    version src installFlags meta dontAddPrefix nativeBuildInputs;

  pname = "backintime-qt";

  buildInputs = [ python' backintime-common ];

  preConfigure = ''
    cd qt
    substituteInPlace configure \
      --replace '"/../etc' '"/etc'
    substituteInPlace qttools.py \
      --replace "__file__, os.pardir, os.pardir" '"${backintime-common}/${python'.sitePackages}/backintime"'
  '';

  preFixup = ''
    wrapQtApp "$out/bin/backintime-qt" \
      --prefix PATH : "${lib.getBin backintime-common}/bin:$PATH"

    substituteInPlace "$out/share/polkit-1/actions/net.launchpad.backintime.policy" \
      --replace "/usr/bin/backintime-qt" "$out/bin/backintime-qt"

    substituteInPlace "$out/share/applications/backintime-qt-root.desktop" \
      --replace "/usr/bin/backintime-qt" "backintime-qt"

    substituteInPlace "$out/share/backintime/qt/serviceHelper.py" \
      --replace "'which'" "'${lib.getBin which}/bin/which'" \
      --replace "/bin/su" "${lib.getBin su}/bin/su" \
      --replace "/usr/bin/backintime" "${lib.getBin backintime-common}/bin/backintime" \
      --replace "/usr/bin/nice" "${lib.getBin coreutils}/bin/nice" \
      --replace "/usr/bin/ionice" "${lib.getBin util-linux}/bin/ionice"

    substituteInPlace "$out/share/dbus-1/system-services/net.launchpad.backintime.serviceHelper.service" \
      --replace "/usr/bin/python3" "${lib.getBin python'}/bin/python3" \
      --replace "/usr/share/backintime" "$out/share/backintime"

    substituteInPlace "$out/bin/backintime-qt_polkit" \
      --replace "/usr/bin/backintime-qt" "$out/bin/backintime-qt"

    wrapProgram "$out/bin/backintime-qt_polkit" \
      --prefix PATH : "${lib.getBin polkit}/bin:$PATH"
  '';
}