nix/nixos/common/services/snapper.nix

32 lines
No EOL
1 KiB
Nix

{ lib, pkgs, desktop, ... }: {
environment.systemPackages = [ pkgs.snapper ] ++ lib.optional (builtins.isString desktop) pkgs.snapper-gui;
# You need to make the snapshot directories manually:
# sudo rm -rf /.snapshots /home/.snapshots /nix/.snapshots
# sudo btrfs subvolume create /.snapshots
# sudo btrfs subvolume create /nix/.snapshots
# sudo btrfs subvolume create /home/.snapshots
services.snapper = {
snapshotRootOnBoot = true;
cleanupInterval = "1d";
snapshotInterval = "hourly";
configs = {
root = {
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
SUBVOLUME = "/";
};
home = {
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
SUBVOLUME = "/home";
};
nix = {
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
SUBVOLUME = "/nix";
};
};
};
}