From 8fb356529ba04379765d87c404930c0c275fc081 Mon Sep 17 00:00:00 2001 From: Giovanni d'Amelio Date: Mon, 6 Jan 2025 16:39:58 -0800 Subject: [PATCH] Start auto zfs snapshots for manganese --- .../machines/manganese/default.nix | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/nixosModules/machines/manganese/default.nix b/src/nixosModules/machines/manganese/default.nix index 732b054..00dac7f 100644 --- a/src/nixosModules/machines/manganese/default.nix +++ b/src/nixosModules/machines/manganese/default.nix @@ -19,18 +19,28 @@ root.nixosModules.users.server # Autosnapshot ZFS and send to NAS - # root.nixosModules.core.zfs-backup - # (_: { - # gio.services.zfs_backup = { - # enable = true; - # syncToGallium = true; - # datasets = [ - # "tank/home" - # "tank/nix" - # "tank/root" - # ]; - # }; - # }) + (_: { + # Automatically create ZFS snapshots + services.sanoid = { + enable = true; + + datasets = let + defaultSnapshotSettings = { + hourly = 48; + daily = 32; + monthly = 8; + yearly = 8; + + autosnap = true; + autoprune = true; + }; + in { + "tank/root" = defaultSnapshotSettings; + "tank/nix" = defaultSnapshotSettings; + "tank/home" = defaultSnapshotSettings; + }; + }; + }) ({pkgs, ...}: { networking.hostId = "cf399625";