Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / networking / sync / backintime / qt.nix
blobbd571b1aed3564dfaa3e0712a26c9fdf44dde62f
1 { lib, mkDerivation, backintime-common, python3, polkit, which, su, coreutils, util-linux }:
3 let
4   python' = python3.withPackages (ps: with ps; [ pyqt5 backintime-common packaging ]);
5 in
6 mkDerivation {
7   inherit (backintime-common)
8     version src installFlags meta dontAddPrefix nativeBuildInputs;
10   pname = "backintime-qt";
12   buildInputs = [ python' backintime-common ];
14   preConfigure = ''
15     cd qt
16     substituteInPlace configure \
17       --replace '"/../etc' '"/etc'
18     substituteInPlace qttools.py \
19       --replace "__file__, os.pardir, os.pardir" '"${backintime-common}/${python'.sitePackages}/backintime"'
20   '';
22   preFixup = ''
23     wrapQtApp "$out/bin/backintime-qt" \
24       --prefix PATH : "${lib.getBin backintime-common}/bin:$PATH"
26     substituteInPlace "$out/share/polkit-1/actions/net.launchpad.backintime.policy" \
27       --replace "/usr/bin/backintime-qt" "$out/bin/backintime-qt"
29     substituteInPlace "$out/share/applications/backintime-qt-root.desktop" \
30       --replace "/usr/bin/backintime-qt" "backintime-qt"
32     substituteInPlace "$out/share/backintime/qt/serviceHelper.py" \
33       --replace "'which'" "'${lib.getBin which}/bin/which'" \
34       --replace "/bin/su" "${lib.getBin su}/bin/su" \
35       --replace "/usr/bin/backintime" "${lib.getBin backintime-common}/bin/backintime" \
36       --replace "/usr/bin/nice" "${lib.getBin coreutils}/bin/nice" \
37       --replace "/usr/bin/ionice" "${lib.getBin util-linux}/bin/ionice"
39     substituteInPlace "$out/share/dbus-1/system-services/net.launchpad.backintime.serviceHelper.service" \
40       --replace "/usr/bin/python3" "${lib.getBin python'}/bin/python3" \
41       --replace "/usr/share/backintime" "$out/share/backintime"
43     substituteInPlace "$out/bin/backintime-qt_polkit" \
44       --replace "/usr/bin/backintime-qt" "$out/bin/backintime-qt"
46     wrapProgram "$out/bin/backintime-qt_polkit" \
47       --prefix PATH : "${lib.getBin polkit}/bin:$PATH"
48   '';