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; + }; +}