Change:
<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>

Discussion:
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.