Change:
Project description System restore tool for Linux This program takes snapshots for the root directory periodically or when told to using either or , and allow the user restore them if need be. It is capable to do cross-distribution restore, or to work from a live CD/USB. ! Not sure if snapshots are important for NixOS, but it saves the day when you need to restore another distribution_ to the previous state inside NixOS, or if you are using nix package manager on other distributions. Metadata homepage URL: source URL: license: gpl3 platforms: linux
Not sure if snapshots are important for NixOS from their readme: It is designed to protect only system files and settings. User files such as documents, pictures and music are excluded. that is not really usefull since nixos already allows rollbacks
It could be useful with Nix on non-NixOS Linux but you might as well use the native package manager to install Timeshift in that case. Being able to offline timeshift non-NixOS distros from your NixOS installation seems like the most sensible use-case.
Being able to offline timeshift non-NixOS distros from your NixOS installation seems like the most sensible use-case. Actually, my original motivation is to rescue my Debian Testing in the laptop. It crashed after the system partition was filled up suddenly (probably by the inflating system logs). I have a working NixOS installation in a USB stick (it is one of the very distros that can be installed onto a removable storage device, making it boot able elsewhere and not affecting the local boot loader at the same time.), and it seems to be a good idea to rescue it from the USB stick. It's probably a bit user-specific. :sweat_smile: BTW, what is the Nixy way to deal with the trouble if something similar (something fills up the disk space suddenly) happen to a NixOS installation? Thanks you very much for answering, and for this wonderful distro!
Delete older generations, run garbage collection and optimise the store. Preferably in that order.
Oh and getting rid of stray gcroots can also help a ton. I had one that kept an old 19.09 system closure around for months.
I marked this as stale due to inactivity. &rarr;
It might not be needed by most of the NixOS users. But the project itself seems to be easy to build (with well-written make files and simple dependencies), and there ale situations that for it to save the day. (NixOS is the only Linux distro that can be successfully installed into a usb stick wihout messing up the /boot partition on the machine or special tweaks for the persistance like persist file/aufs). I can write one when I have time.
I marked this as stale due to inactivity. &rarr;
It's still relevant.
I think this is going to help those who want to upgrade from a previous system's version.
AFAIK, this snapshot tool is commonly seen in Debian-based distros, and the Ubuntu and Linux Mint encourage users to use it. Remaining issues: The "periodic snapshot" functionality requires crontab access from superuser. This is not enabled by deafult, and can be disabled at run time. If we want to have it on NixOS, it may require special patches and a NixOS module. expects to exist before it starts. I'm not sure how other packages manage that.

Discussion:
<ins> { callPackage , timeshift-unwrapped , lib , rsync , coreutils , mount , umount , psmisc , cron , btrfs-progs , grubPackage }: let timeshift-wrapper = callPackage ./wrapper.nix { }; in (timeshift-wrapper timeshift-unwrapped ([ rsync coreutils mount umount psmisc cron btrfs-progs grubPackage ])).overrideAttrs (oldAttrs: { meta = oldAttrs.meta // { description = oldAttrs.meta.description; longDescription = oldAttrs.meta.longDescription + '' This package comes with runtime dependencies of command utilities provided by rsync, coreutils, mount, umount, psmisc, cron and (optionally) btrfs. If you want to use the commands provided by the system, override the propagatedBuildInputs or use timeshift-minimal instead ''; }; }) </ins>

<ins> { callPackage , timeshift-unwrapped }: let timeshift-wrapper = callPackage ./wrapper.nix { }; in (timeshift-wrapper timeshift-unwrapped [ ]).overrideAttrs (oldAttrs: { meta = oldAttrs.meta // { description = oldAttrs.meta.description + " (without runtime dependencies)"; longDescription = oldAttrs.meta.longDescription + '' This package is a wrapped version of timeshift-unwrapped without runtime dependencies of command utilities. ''; }; }) </ins>

<ins> diff --git a/src/timeshift-launcher b/src/timeshift-launcher index 29b8fc4..5f6cb17 100755 --- a/src/timeshift-launcher +++ b/src/timeshift-launcher @@ -1,6 +1,6 @@ #!/bin/bash -app_command='timeshift-gtk' +app_command=''"$(realpath "$(dirname "$0")")"'/timeshift-gtk' if [ "$(id -u)" -eq 0 ]; then # user is admin @@ -14,11 +14,11 @@ else # script is running in non-interactive mode if [ "$XDG_SESSION_TYPE" = "wayland" ] ; then xhost +SI:localuser:root -			pkexec ${app_command} +			pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" "${app_command}" xhost -SI:localuser:root xhost elif command -v pkexec >/dev/null 2>&1; then -			pkexec ${app_command} +			pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" "${app_command}" elif command -v sudo >/dev/null 2>&1; then x-terminal-emulator -e "sudo ${app_command}" elif command -v su >/dev/null 2>&1; then </ins>

<ins> { lib , stdenv , fetchFromGitHub , gettext , pkg-config , vala , which , gtk3 , json-glib , libgee , utillinux , vte , xapps }: stdenv.mkDerivation rec { pname = "timeshift"; version = "22.06.1"; src = fetchFromGitHub { owner = "linuxmint"; repo = "timeshift"; rev = "v${version}"; sha256 = "XcxwVBKMv2YwbrI3FFWDQFs8hHruhkZq3YqzkptE6KE="; }; patches = [ ./timeshift-launcher.patch ]; postPatch = '' while IFS="" read -r -d $'0' FILE; do substituteInPlace "$FILE"  --replace "/sbin/blkid" "${utillinux}/bin/blkid" done < <(find ./src -mindepth 1 -name "*.vala" -type f -print0) substituteInPlace ./src/Utility/IconManager.vala  --replace "/usr/share" "$out/share" substituteInPlace ./src/Core/Main.vala  --replace "/etc/timeshift/default.json" "$out/etc/timeshift/default.json"  --replace "file_copy(app_conf_path_default, app_conf_path);" "if (!dir_exists(file_parent(app_conf_path))){dir_create(file_parent(app_conf_path));};file_copy(app_conf_path_default, app_conf_path);" ''; nativeBuildInputs = [ gettext pkg-config vala which ]; buildInputs = [ gtk3 json-glib libgee vte xapps ]; preBuild = '' makeFlagsArray+=(  "-C" "src"  "prefix=$out"  "sysconfdir=$out/etc"  ) ''; meta = with lib; { description = "A system restore tool for Linux"; longDescription = '' TimeShift creates filesystem snapshots using rsync+hardlinks or BTRFS snapshots. Snapshots can be restored using TimeShift installed on the system or from Live CD or USB. ''; homepage = "https://github.com/linuxmint/timeshift"; license = licenses.gpl3; platforms = platforms.linux; maintainers = with maintainers; [ ShamrockLee ]; }; } </ins>

<ins> { stdenvNoCC , lib , wrapGAppsHook , gdk-pixbuf , librsvg , xorg , shared-mime-info }: timeshift-unwrapped: runtimeDeps: stdenvNoCC.mkDerivation { inherit (timeshift-unwrapped) pname version; dontUnpack = true; nativeBuildInputs = [ xorg.lndir wrapGAppsHook ]; installPhase = '' runHook preInstall mkdir -p "$out" lndir "${timeshift-unwrapped}" "$out" runHook postInstall ''; dontWrapGApps = true; preFixup = '' makeWrapperArgs=( --prefix PATH : "${lib.makeBinPath runtimeDeps}" ) gappsWrapperArgs+=( # Thumbnailers --prefix XDG_DATA_DIRS : "${lib.makeSearchPath "share" [ gdk-pixbuf librsvg shared-mime-info ]}" "''${makeWrapperArgs[@]}" ) wrapProgram "$out/bin/timeshift" "''${makeWrapperArgs[@]}" wrapProgram "$out/bin/timeshift-gtk" "''${gappsWrapperArgs[@]}" ''; inherit (timeshift-unwrapped) meta; } </ins>

timelimit = callPackage ../tools/misc/timelimit { }; <ins> timeshift-unwrapped = callPackage ../applications/backup/timeshift/unwrapped.nix { inherit (cinnamon) xapps; }; timeshift = callPackage ../applications/backup/timeshift { grubPackage = grub2_full; }; timeshift-minimal = callPackage ../applications/backup/timeshift/minimal.nix { }; </ins> timewarrior = callPackage ../applications/misc/timewarrior { }; timew-sync-server = callPackage ../applications/misc/timew-sync-server { };