From f332325d079bdf05f34ae4d64776e33d9da87253 Mon Sep 17 00:00:00 2001 From: iFargle Date: Thu, 28 Dec 2023 18:36:09 +0900 Subject: [PATCH] Update snapshots and snapshot intervals in snapper --- nixos/common/services/snapper.nix | 8 +------- nixos/hosts/framework-server/disks.nix | 6 ------ nixos/hosts/nixos-desktop/disks.nix | 21 +++++++++++++++++---- nixos/hosts/nixos-framework/disks.nix | 18 +++++++++++++----- nixos/hosts/nuc-server/disks.nix | 18 +++++++++++++----- 5 files changed, 44 insertions(+), 27 deletions(-) diff --git a/nixos/common/services/snapper.nix b/nixos/common/services/snapper.nix index 959ef0a9..4f82c675 100644 --- a/nixos/common/services/snapper.nix +++ b/nixos/common/services/snapper.nix @@ -1,15 +1,9 @@ { 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"; + cleanupInterval = "7d"; snapshotInterval = "hourly"; configs = { root = { diff --git a/nixos/hosts/framework-server/disks.nix b/nixos/hosts/framework-server/disks.nix index bbf32579..2baf2cff 100644 --- a/nixos/hosts/framework-server/disks.nix +++ b/nixos/hosts/framework-server/disks.nix @@ -1,11 +1,5 @@ { imports = [ ../../common/services/snapper.nix ]; - # 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 - # sudo btrfs subvolume create /Storage/.snapshots # extra configs not present in the standard config above services.snapper.configs.Storage = { diff --git a/nixos/hosts/nixos-desktop/disks.nix b/nixos/hosts/nixos-desktop/disks.nix index 2459fd9f..49c8d44c 100644 --- a/nixos/hosts/nixos-desktop/disks.nix +++ b/nixos/hosts/nixos-desktop/disks.nix @@ -1,9 +1,5 @@ { imports = [ ../../common/services/snapper.nix ]; - # You need to make the snapshot directories manually: - # sudo btrfs subvolume create /.snapshots - # sudo btrfs subvolume create /nix/.snapshots - # sudo btrfs subvolume create /home/.snapshots services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.interval = "weekly"; @@ -51,6 +47,23 @@ mountpoint = "/nix"; mountOptions = [ "compress=zstd" "noatime" ]; }; # nix + "/games" = { + mountpoint = "/games"; + mountOptions = [ "noatime" ]; + }; # games + # SNAPSHOT SUBVOLS + "/root/.snapshots" = { + mountpoint = "/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home/.snapshots" = { + mountpoint = "/home/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix/.snapshots" = { + mountpoint = "/nix/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix }; # subvolumes }; # content.content }; # content diff --git a/nixos/hosts/nixos-framework/disks.nix b/nixos/hosts/nixos-framework/disks.nix index 259a7554..5d888bbe 100644 --- a/nixos/hosts/nixos-framework/disks.nix +++ b/nixos/hosts/nixos-framework/disks.nix @@ -1,10 +1,5 @@ { imports = [ ../../common/services/snapper.nix ]; - # 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.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.interval = "weekly"; @@ -52,6 +47,19 @@ mountpoint = "/nix"; mountOptions = [ "compress=zstd" "noatime" ]; }; # nix + # SNAPSHOT SUBVOLS + "/root/.snapshots" = { + mountpoint = "/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home/.snapshots" = { + mountpoint = "/home/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix/.snapshots" = { + mountpoint = "/nix/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix }; # subvolumes }; # content.content }; # content diff --git a/nixos/hosts/nuc-server/disks.nix b/nixos/hosts/nuc-server/disks.nix index e6b75dbe..609f6371 100644 --- a/nixos/hosts/nuc-server/disks.nix +++ b/nixos/hosts/nuc-server/disks.nix @@ -1,10 +1,5 @@ { imports = [ ../../common/services/snapper.nix ]; - # 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.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.interval = "weekly"; @@ -52,6 +47,19 @@ mountpoint = "/nix"; mountOptions = [ "compress=zstd" "noatime" ]; }; # nix + # SNAPSHOT SUBVOLS + "/root/.snapshots" = { + mountpoint = "/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home/.snapshots" = { + mountpoint = "/home/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix/.snapshots" = { + mountpoint = "/nix/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix }; # subvolumes }; # content.content }; # content