From ce0954fc61346b8776bea8edd9cb48f6a0d4f5ba Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Sat, 10 Jul 2021 09:00:21 +0700 Subject: [PATCH] add snapper --- hosts/winter/default.nix | 1 + hosts/winter/hardware-configuration.nix | 6 ++++++ hosts/winter/snapper.nix | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 hosts/winter/snapper.nix diff --git a/hosts/winter/default.nix b/hosts/winter/default.nix index d7c8030..b587f5f 100644 --- a/hosts/winter/default.nix +++ b/hosts/winter/default.nix @@ -20,6 +20,7 @@ ./networking.nix ./packages.nix ./security.nix + ./snapper.nix ../../users/rin ]; diff --git a/hosts/winter/hardware-configuration.nix b/hosts/winter/hardware-configuration.nix index fee857b..faac99d 100644 --- a/hosts/winter/hardware-configuration.nix +++ b/hosts/winter/hardware-configuration.nix @@ -42,6 +42,12 @@ options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=260" ]; }; + fileSystems."/home/.snapshots" = + { device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d"; + fsType = "btrfs"; + options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=319" ]; + }; + fileSystems."/root" = { device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d"; fsType = "btrfs"; diff --git a/hosts/winter/snapper.nix b/hosts/winter/snapper.nix new file mode 100644 index 0000000..2bb55f0 --- /dev/null +++ b/hosts/winter/snapper.nix @@ -0,0 +1,18 @@ +{ config, lib, ... }: { + services.snapper = { + configs.home = { + fstype = "btrfs"; + subvolume = "/home"; + extraConfig = lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${k}=${v}") { + TIMELINE_CLEANUP = "yes"; + TIMELINE_CREATE = "yes"; + TIMELINE_MIN_AGE = "1800"; + TIMELINE_LIMIT_HOURLY = "5"; + TIMELINE_LIMIT_DAILY = "7"; + TIMELINE_LIMIT_WEEKLY = "0"; + TIMELINE_LIMIT_MONTHLY = "0"; + TIMELINE_LIMIT_YEARLY = "0"; + }); + }; + }; +}