snapper: enable for ALL hosts

This commit is contained in:
2025-01-19 08:18:12 +00:00
parent ffd3ecd465
commit ea9d42b778
3 changed files with 30 additions and 27 deletions

View File

@@ -53,31 +53,4 @@
# TODO(2025-01-01): re-enable once rocm build is fixed: <https://github.com/NixOS/nixpkgs/pull/367695> # TODO(2025-01-01): re-enable once rocm build is fixed: <https://github.com/NixOS/nixpkgs/pull/367695>
# hardware.amdgpu.opencl.enable = true; # desktop (AMD's opencl implementation AKA "ROCM"); probably required for ollama # hardware.amdgpu.opencl.enable = true; # desktop (AMD's opencl implementation AKA "ROCM"); probably required for ollama
# snapper: btrfs auto-snapshots:
# - <https://wiki.archlinux.org/title/Snapper>
# - `man snapper-configs`
#
# to list snapshots: `snapper list`
# to take a snapshot: `snapper create` or `systemctl start snapper-timeline.service`
#
# FIRST TIME SETUP:
# - `sudo btrfs subvolume create /nix/persist`
# - if migrating from a non-subvol `/nix/persist`, then:
# - `sudo btrfs subvolume create /nix/persist.new`
# - `sudo cp --archive --one-file-system --reflink=always /nix/persist/. /nix/persist.new`
# - `sudo bash -c 'mv /nix/persist /nix/persist.old && mv /nix/persist.new /nix/persist`
# - `sudo btrfs subvolume create /nix/persist/.snapshots`
# - reboot (else all snapper calls will fail due to dbus errors)
services.snapper.configs.root = {
SUBVOLUME = "/nix/persist";
ALLOW_USERS = [ "colin" ];
TIMELINE_CLEANUP = true; # remove old snapshots every 24h
TIMELINE_CREATE = true; # take a snapshot every hour
TIMELINE_LIMIT_HOURLY = 12;
TIMELINE_LIMIT_DAILY = 7; # keep snapshots for 1d ago, 2d ago, ... 7day ago
TIMELINE_LIMIT_WEEKLY = 4; # keep snapshots for 7d ago, 14d ago, 21d ago, 28d ago
TIMELINE_LIMIT_MONTHLY = 0;
TIMELINE_LIMIT_YEARLY = 0;
};
} }

View File

@@ -14,6 +14,7 @@
./programs ./programs
./quirks.nix ./quirks.nix
./secrets.nix ./secrets.nix
./snapper.nix
./ssh.nix ./ssh.nix
./systemd.nix ./systemd.nix
./users ./users

29
hosts/common/snapper.nix Normal file
View File

@@ -0,0 +1,29 @@
{ ... }:
{
# snapper: btrfs auto-snapshots:
# - <https://wiki.archlinux.org/title/Snapper>
# - `man snapper-configs`
#
# to list snapshots: `snapper list`
# to take a snapshot: `snapper create` or `systemctl start snapper-timeline.service`
#
# FIRST TIME SETUP:
# - `sudo btrfs subvolume create /nix/persist`
# - if migrating from a non-subvol `/nix/persist`, then:
# - `sudo btrfs subvolume create /nix/persist.new`
# - `sudo cp --archive --one-file-system --reflink=always /nix/persist/. /nix/persist.new`
# - `sudo bash -c 'mv /nix/persist /nix/persist.old && mv /nix/persist.new /nix/persist`
# - `sudo btrfs subvolume create /nix/persist/.snapshots`
# - reboot (else all snapper calls will fail due to dbus errors)
services.snapper.configs.root = {
SUBVOLUME = "/nix/persist";
ALLOW_USERS = [ "colin" ];
TIMELINE_CLEANUP = true; # remove old snapshots every 24h
TIMELINE_CREATE = true; # take a snapshot every hour
TIMELINE_LIMIT_HOURLY = 12;
TIMELINE_LIMIT_DAILY = 7; # keep snapshots for 1d ago, 2d ago, ... 7day ago
TIMELINE_LIMIT_WEEKLY = 4; # keep snapshots for 7d ago, 14d ago, 21d ago, 28d ago
TIMELINE_LIMIT_MONTHLY = 0;
TIMELINE_LIMIT_YEARLY = 0;
};
}