From c523e6075b1778243952126dc25dbc6d2a9f7067 Mon Sep 17 00:00:00 2001 From: Leyla Becker Date: Wed, 1 Jan 2025 20:03:01 -0600 Subject: [PATCH] added scrubbing and aut snapshot to defiant --- modules/nixos-modules/disko.nix | 5 +++++ modules/nixos-modules/impermanence.nix | 10 +++++++--- modules/nixos-modules/users.nix | 3 --- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/nixos-modules/disko.nix b/modules/nixos-modules/disko.nix index b65538d..f95edcf 100644 --- a/modules/nixos-modules/disko.nix +++ b/modules/nixos-modules/disko.nix @@ -50,6 +50,11 @@ in { }; config = lib.mkIf config.host.storage.enable { + services.zfs = { + autoScrub.enable = true; + autoSnapshot.enable = true; + }; + disko.devices = { disk = ( builtins.listToAttrs ( diff --git a/modules/nixos-modules/impermanence.nix b/modules/nixos-modules/impermanence.nix index a187226..66139ce 100644 --- a/modules/nixos-modules/impermanence.nix +++ b/modules/nixos-modules/impermanence.nix @@ -67,18 +67,22 @@ "persist" = { type = "zfs_fs"; options.canmount = "off"; + options = { + "com.sun:auto-snapshot" = "true"; + }; }; # this is where root data actually lives "persist/system/root" = { type = "zfs_fs"; mountpoint = "/persist/system/root"; - options = { - "com.sun:auto-snapshot" = "true"; - }; }; "persist/system/var/log" = { type = "zfs_fs"; mountpoint = "/persist/system/var/log"; + # logs should be append only so we shouldn't need to snapshot them + options = { + "com.sun:auto-snapshot" = "false"; + }; }; }; diff --git a/modules/nixos-modules/users.nix b/modules/nixos-modules/users.nix index efd39f3..704413a 100644 --- a/modules/nixos-modules/users.nix +++ b/modules/nixos-modules/users.nix @@ -347,9 +347,6 @@ in { "persist/home/${user.name}" = { type = "zfs_fs"; mountpoint = "/persist/home/${user.name}"; - options = { - "com.sun:auto-snapshot" = "true"; - }; }; }) normalUsers