From 6a5774b9b980068db45500ed333df6f94485b33d Mon Sep 17 00:00:00 2001 From: Jimbo Date: Tue, 5 Nov 2024 01:48:41 -0500 Subject: [PATCH] Revert "Gonna reinstall with zfs now wish me luck" This reverts commit ee7dc7925d0fd243c9eaaa9892e985afb30e1272. --- hosts/firefly/disko/default.nix | 68 ++++++++----------- modules/system/devices/disks/default.nix | 1 + .../system/devices/disks/snapper/default.nix | 13 ++++ .../devices/disks/snapper/jimbo/default.nix | 12 ++++ .../devices/disks/snapper/root/default.nix | 12 ++++ 5 files changed, 67 insertions(+), 39 deletions(-) create mode 100644 modules/system/devices/disks/snapper/default.nix create mode 100644 modules/system/devices/disks/snapper/jimbo/default.nix create mode 100644 modules/system/devices/disks/snapper/root/default.nix diff --git a/hosts/firefly/disko/default.nix b/hosts/firefly/disko/default.nix index 9198bf5..0118394 100644 --- a/hosts/firefly/disko/default.nix +++ b/hosts/firefly/disko/default.nix @@ -19,7 +19,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; + mountOptions = [ "fmask=0022" "dmask=0022" ]; }; }; luks = { @@ -27,7 +27,8 @@ content = { type = "luks"; name = "crypt-nvme"; - passwordFile = "/tmp/secret.key"; + settings.allowDiscards = true; + #passwordFile = "/tmp/secret.key"; content = { type = "lvm_pv"; vg = "nixos"; @@ -46,8 +47,32 @@ root = { size = "100%"; content = { - type = "zfs"; - pool = "zroot"; + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/@" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + "/@prev" = { + mountpoint = "/prev"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + "/@nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + + # Impermanence + "/@root" = { + mountpoint = "/persist"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + "/@jimbo" = { + mountpoint = "/persist/home/jimbo"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; + }; }; }; swap = { @@ -60,41 +85,6 @@ }; }; }; - - zpool = { - zroot = { - type = "zpool"; - mode = "single"; - options.cachefile = "none"; - datasets = { - root = { - type = "zfs_fs"; - mountpoint = "/"; - options."com.sun:auto-snapshot" = "false"; - }; - prev = { - type = "zfs_fs"; - mountpoint = "/prev"; - options."com.sun:auto-snapshot" = "false"; - }; - nix = { - type = "zfs_fs"; - mountpoint = "/nix"; - options."com.sun:auto-snapshot" = "false"; - }; - - # Impermanence - persist = { - type = "zfs_fs"; - mountpoint = "/persist"; - }; - jimbo = { - type = "zfs_fs"; - mountpoint = "/persist/home/jimbo"; - }; - }; - }; - }; }; # Needed for impermanence diff --git a/modules/system/devices/disks/default.nix b/modules/system/devices/disks/default.nix index 69ebd0e..3576248 100644 --- a/modules/system/devices/disks/default.nix +++ b/modules/system/devices/disks/default.nix @@ -3,5 +3,6 @@ imports = [ ./filesystems ./impermanence + ./snapper ]; } diff --git a/modules/system/devices/disks/snapper/default.nix b/modules/system/devices/disks/snapper/default.nix new file mode 100644 index 0000000..a4291bf --- /dev/null +++ b/modules/system/devices/disks/snapper/default.nix @@ -0,0 +1,13 @@ +{ ... }: +{ + imports = [ + ./root + ./jimbo + ]; + + services.snapper = { + snapshotInterval = "0/6:00:00"; + cleanupInterval = "12:00:00"; + persistentTimer = true; + }; +} diff --git a/modules/system/devices/disks/snapper/jimbo/default.nix b/modules/system/devices/disks/snapper/jimbo/default.nix new file mode 100644 index 0000000..56e07d5 --- /dev/null +++ b/modules/system/devices/disks/snapper/jimbo/default.nix @@ -0,0 +1,12 @@ +{ ... }: +{ + services.snapper.configs.jimbo = { + SUBVOLUME = "/persist/home/jimbo"; + TIMELINE_CREATE = true; + TIMELINE_CLEANUP = true; + TIMELINE_LIMIT_DAILY = 1; + TIMELINE_LIMIT_WEEKLY = 1; + TIMELINE_LIMIT_MONTHLY = 0; + TIMELINE_LIMIT_YEARLY = 0; + }; +} diff --git a/modules/system/devices/disks/snapper/root/default.nix b/modules/system/devices/disks/snapper/root/default.nix new file mode 100644 index 0000000..92e28cf --- /dev/null +++ b/modules/system/devices/disks/snapper/root/default.nix @@ -0,0 +1,12 @@ +{ ... }: +{ + services.snapper.configs.root = { + SUBVOLUME = "/persist"; + TIMELINE_CREATE = true; + TIMELINE_CLEANUP = true; + TIMELINE_LIMIT_DAILY = 1; + TIMELINE_LIMIT_WEEKLY = 0; + TIMELINE_LIMIT_MONTHLY = 0; + TIMELINE_LIMIT_YEARLY = 0; + }; +}