anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / networking / sync / backintime / qt.nix
blob136b91a0623cf0ffa14d39a81fc9cc9575dd1748
1 { lib, stdenv, backintime-common, python3, polkit, which, su, coreutils, util-linux,
2 wrapQtAppsHook, qtbase, qtwayland }:
4 let
5   python' = python3.withPackages (ps: with ps; [ pyqt6 backintime-common packaging ]);
6 in
7 stdenv.mkDerivation {
8   inherit (backintime-common)
9     version src installFlags meta dontAddPrefix;
11   pname = "backintime-qt";
13   buildInputs = [ python' backintime-common qtbase qtwayland ];
15   nativeBuildInputs = backintime-common.nativeBuildInputs or [ ] ++ [
16     wrapQtAppsHook
17   ];
19   configureFlags = [ "--python=${lib.getExe python'}" ];
21   preConfigure = ''
22     patchShebangs --build updateversion.sh
23     cd qt
24     substituteInPlace qttools_path.py \
25       --replace "__file__, os.pardir, os.pardir" '"${backintime-common}/${python'.sitePackages}/backintime"'
26   '';
28   preFixup = ''
29     wrapQtApp "$out/bin/backintime-qt" \
30       --prefix PATH : "${lib.getBin backintime-common}/bin:$PATH"
32     substituteInPlace "$out/share/polkit-1/actions/net.launchpad.backintime.policy" \
33       --replace-fail "/usr/bin/backintime-qt" "$out/bin/backintime-qt"
35     substituteInPlace "$out/share/applications/backintime-qt-root.desktop" \
36       --replace-fail "/usr/bin/backintime-qt" "backintime-qt"
38     substituteInPlace "$out/share/backintime/qt/serviceHelper.py" \
39       --replace-fail "'which'" "'${lib.getExe which}'" \
40       --replace-fail "/bin/su" "${lib.getBin su}/bin/su" \
41       --replace-fail "/usr/bin/backintime" "${lib.getExe backintime-common}" \
42       --replace-fail "/usr/bin/nice" "${lib.getBin coreutils}/bin/nice" \
43       --replace-fail "/usr/bin/ionice" "${lib.getBin util-linux}/bin/ionice"
45     substituteInPlace "$out/share/dbus-1/system-services/net.launchpad.backintime.serviceHelper.service" \
46       --replace-fail "/usr/share/backintime" "$out/share/backintime"
48     substituteInPlace "$out/bin/backintime-qt_polkit" \
49       --replace-fail "/usr/bin/backintime-qt" "$out/bin/backintime-qt"
51     wrapProgram "$out/bin/backintime-qt_polkit" \
52       --prefix PATH : "${lib.getBin polkit}/bin:$PATH"
53   '';