From 8c5116e6a52a2e6ea878d0ecdee4d5f3be58088f Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Sat, 7 Dec 2024 20:35:23 +0800 Subject: [PATCH] timeshift: explain the timeshift-launcher string substitution --- pkgs/applications/backup/timeshift/unwrapped.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/applications/backup/timeshift/unwrapped.nix b/pkgs/applications/backup/timeshift/unwrapped.nix index cb62703ab37c..8b26c3ca0f28 100644 --- a/pkgs/applications/backup/timeshift/unwrapped.nix +++ b/pkgs/applications/backup/timeshift/unwrapped.nix @@ -35,6 +35,8 @@ stdenv.mkDerivation rec { substituteInPlace ./src/Utility/IconManager.vala \ --replace-fail "/usr/share" "$out/share" + # Substitute app_command to look for the `timeshift-gtk` in the same directory as the executed `timeshift-launcher`. + # Substitute the `pkexec ...` as a hack to run a GUI application like Timeshift as root without setting up the corresponding pkexec policy. substituteInPlace ./src/timeshift-launcher \ --replace-fail "app_command='timeshift-gtk'" ${lib.escapeShellArg ''app_command="$(realpath "$(dirname "$0")")/timeshift-gtk"''} \ --replace-fail ${lib.escapeShellArg ''pkexec ''${app_command}''} ${lib.escapeShellArg ''pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" "''${app_command}"''}