1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 gettext,
6 help2man,
7 meson,
8 ninja,
9 pkg-config,
10 vala,
11 gtk3,
12 json-glib,
13 libgee,
14 util-linux,
15 vte,
16 xapp,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "timeshift";
21 version = "24.06.6";
22
23 src = fetchFromGitHub {
24 owner = "linuxmint";
25 repo = "timeshift";
26 rev = version;
27 hash = "sha256-umMekxP9bvV01KzfIh2Zxa9Xb+tR5x+tG9dOnBIOkjY=";
28 };
29
30 postPatch = ''
31 for FILE in src/Core/Main.vala src/Utility/Device.vala; do
32 substituteInPlace "$FILE" \
33 --replace-fail "/sbin/blkid" "${lib.getExe' util-linux "blkid"}"
34 done
35
36 substituteInPlace ./src/Utility/IconManager.vala \
37 --replace-fail "/usr/share" "$out/share"
38
39 # Substitute app_command to look for the `timeshift-gtk` in $out.
40 # Substitute the `pkexec ...` as a hack to run a GUI application like Timeshift as root without setting up the corresponding pkexec policy.
41 substituteInPlace ./src/timeshift-launcher \
42 --replace-fail "app_command='timeshift-gtk'" "app_command=$out/bin/timeshift-gtk" \
43 --replace-fail ${lib.escapeShellArg ''pkexec ''${app_command}''} ${lib.escapeShellArg ''pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" "''${app_command}"''}
44 '';
45
46 nativeBuildInputs = [
47 gettext
48 help2man
49 meson
50 ninja
51 pkg-config
52 vala
53 ];
54
55 buildInputs = [
56 gtk3
57 json-glib
58 libgee
59 vte
60 xapp
61 ];
62
63 env = lib.optionalAttrs stdenv.cc.isGNU {
64 NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
65 };
66
67 meta = with lib; {
68 description = "System restore tool for Linux";
69 longDescription = ''
70 TimeShift creates filesystem snapshots using rsync+hardlinks or BTRFS snapshots.
71 Snapshots can be restored using TimeShift installed on the system or from Live CD or USB.
72 '';
73 homepage = "https://github.com/linuxmint/timeshift";
74 license = licenses.gpl2Plus;
75 platforms = platforms.linux;
76 maintainers = with maintainers; [
77 ShamrockLee
78 bobby285271
79 ];
80 };
81}