diff --git a/hosts/acheron/configuration.nix b/hosts/acheron/configuration.nix index e3a18ac..74dc790 100644 --- a/hosts/acheron/configuration.nix +++ b/hosts/acheron/configuration.nix @@ -63,6 +63,32 @@ fileSystems = ["/" "/home" "/nix"]; }; + # Snapper — automatic btrfs snapshots so you can roll back + services.snapper = { + enable = true; + # Snapshot / every hour, keep 10 hourly and 7 daily + rootConfig = '' + TIMELINE_CREATE="yes" + TIMELINE_CLEANUP="yes" + TIMELINE_MIN_AGE="1800" + TIMELINE_LIMIT_HOURLY="10" + TIMELINE_LIMIT_DAILY="7" + TIMELINE_LIMIT_MONTHLY="3" + TIMELINE_LIMIT_YEARLY="0" + ''; + # Snapshot /home every 4 hours + homeConfig = '' + SUBVOLUME="/home" + TIMELINE_CREATE="yes" + TIMELINE_CLEANUP="yes" + TIMELINE_MIN_AGE="14400" + TIMELINE_LIMIT_HOURLY="6" + TIMELINE_LIMIT_DAILY="14" + TIMELINE_LIMIT_MONTHLY="3" + TIMELINE_LIMIT_YEARLY="0" + ''; + }; + # Set your time zone. time.timeZone = "America/Los_Angeles"; diff --git a/hosts/armaros/configuration.nix b/hosts/armaros/configuration.nix index 92ae14c..d94c954 100644 --- a/hosts/armaros/configuration.nix +++ b/hosts/armaros/configuration.nix @@ -57,6 +57,32 @@ fileSystems = ["/" "/home" "/nix"]; }; + # Snapper — automatic btrfs snapshots so you can roll back + services.snapper = { + enable = true; + # Snapshot / every hour, keep 10 hourly and 7 daily + rootConfig = '' + TIMELINE_CREATE="yes" + TIMELINE_CLEANUP="yes" + TIMELINE_MIN_AGE="1800" + TIMELINE_LIMIT_HOURLY="10" + TIMELINE_LIMIT_DAILY="7" + TIMELINE_LIMIT_MONTHLY="3" + TIMELINE_LIMIT_YEARLY="0" + ''; + # Snapshot /home every 4 hours + homeConfig = '' + SUBVOLUME="/home" + TIMELINE_CREATE="yes" + TIMELINE_CLEANUP="yes" + TIMELINE_MIN_AGE="14400" + TIMELINE_LIMIT_HOURLY="6" + TIMELINE_LIMIT_DAILY="14" + TIMELINE_LIMIT_MONTHLY="3" + TIMELINE_LIMIT_YEARLY="0" + ''; + }; + # Set your time zone. time.timeZone = "America/Los_Angeles"; diff --git a/hosts/buildbox/configuration.nix b/hosts/buildbox/configuration.nix index 7a50547..f8784cc 100644 --- a/hosts/buildbox/configuration.nix +++ b/hosts/buildbox/configuration.nix @@ -34,6 +34,39 @@ options = "--delete-older-than 30d"; }; + # Btrfs filesystem + services.btrfs.autoScrub = { + enable = true; + interval = "weekly"; + fileSystems = ["/" "/home" "/nix"]; + }; + + # Snapper — automatic btrfs snapshots so you can roll back + services.snapper = { + enable = true; + # Snapshot / every hour, keep 10 hourly and 7 daily + rootConfig = '' + TIMELINE_CREATE="yes" + TIMELINE_CLEANUP="yes" + TIMELINE_MIN_AGE="1800" + TIMELINE_LIMIT_HOURLY="10" + TIMELINE_LIMIT_DAILY="7" + TIMELINE_LIMIT_MONTHLY="3" + TIMELINE_LIMIT_YEARLY="0" + ''; + # Snapshot /home every 4 hours + homeConfig = '' + SUBVOLUME="/home" + TIMELINE_CREATE="yes" + TIMELINE_CLEANUP="yes" + TIMELINE_MIN_AGE="14400" + TIMELINE_LIMIT_HOURLY="6" + TIMELINE_LIMIT_DAILY="14" + TIMELINE_LIMIT_MONTHLY="3" + TIMELINE_LIMIT_YEARLY="0" + ''; + }; + networking.hostName = "buildbox"; # Define your hostname. # Enable networking @@ -53,13 +86,6 @@ algorithm = "zstd"; }; - # Btrfs auto-scrub - services.btrfs.autoScrub = { - enable = true; - interval = "weekly"; - fileSystems = ["/" "/home" "/nix"]; - }; - # Set your time zone. time.timeZone = "America/Los_Angeles"; diff --git a/hosts/buildbox/disko-config.nix b/hosts/buildbox/disko-config.nix index 3ea1bd7..ccf3076 100644 --- a/hosts/buildbox/disko-config.nix +++ b/hosts/buildbox/disko-config.nix @@ -1,6 +1,7 @@ # ── buildbox disk layout ──────────────────────────────────────── -# QEMU VM: Btrfs with subvolumes for snapshot-capable root, home, -# nix store, logs, and snapshot directory. +# QEMU VM: ESP + dedicated swap partition + Btrfs root with +# subvolumes for snapshot-capable root, home, nix store, logs, +# and snapshot directory. # # Run from rescue ISO: # disko --mode disko /etc/disko-config.nix @@ -26,6 +27,14 @@ mountOptions = ["umask=0077"]; }; }; + swap = { + size = "8G"; + content = { + type = "swap"; + priority = 10; + discardPolicy = "both"; + }; + }; root = { size = "100%"; content = { diff --git a/hosts/ender-ml/configuration.nix b/hosts/ender-ml/configuration.nix index 77af9f9..dd26fb8 100644 --- a/hosts/ender-ml/configuration.nix +++ b/hosts/ender-ml/configuration.nix @@ -12,6 +12,8 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + # Declarative disk layout (consumed by disko + nixos-anywhere). + ./disko-config.nix inputs.home-manager.nixosModules.default ]; @@ -24,7 +26,6 @@ boot.loader.efi.canTouchEfiVariables = true; boot.loader.systemd-boot.graceful = true; - nix.settings.experimental-features = ["nix-command" "flakes"]; # Nix optimizations @@ -37,6 +38,39 @@ options = "--delete-older-than 30d"; }; + # Btrfs filesystem + services.btrfs.autoScrub = { + enable = true; + interval = "weekly"; + fileSystems = ["/" "/home" "/nix"]; + }; + + # Snapper — automatic btrfs snapshots so you can roll back + services.snapper = { + enable = true; + # Snapshot / every hour, keep 10 hourly and 7 daily + rootConfig = '' + TIMELINE_CREATE="yes" + TIMELINE_CLEANUP="yes" + TIMELINE_MIN_AGE="1800" + TIMELINE_LIMIT_HOURLY="10" + TIMELINE_LIMIT_DAILY="7" + TIMELINE_LIMIT_MONTHLY="3" + TIMELINE_LIMIT_YEARLY="0" + ''; + # Snapshot /home every 4 hours + homeConfig = '' + SUBVOLUME="/home" + TIMELINE_CREATE="yes" + TIMELINE_CLEANUP="yes" + TIMELINE_MIN_AGE="14400" + TIMELINE_LIMIT_HOURLY="6" + TIMELINE_LIMIT_DAILY="14" + TIMELINE_LIMIT_MONTHLY="3" + TIMELINE_LIMIT_YEARLY="0" + ''; + }; + networking.hostName = "ender-ml"; # Define your hostname. # Enable networking diff --git a/hosts/ender-ml/disko-config.nix b/hosts/ender-ml/disko-config.nix index 3ea1bd7..4cd3126 100644 --- a/hosts/ender-ml/disko-config.nix +++ b/hosts/ender-ml/disko-config.nix @@ -1,6 +1,7 @@ -# ── buildbox disk layout ──────────────────────────────────────── -# QEMU VM: Btrfs with subvolumes for snapshot-capable root, home, -# nix store, logs, and snapshot directory. +# ── ender-ml disk layout ──────────────────────────────────────── +# QEMU VM: ESP + dedicated swap partition + Btrfs root with +# subvolumes for snapshot-capable root, home, nix store, logs, +# and snapshot directory. # # Run from rescue ISO: # disko --mode disko /etc/disko-config.nix @@ -26,6 +27,14 @@ mountOptions = ["umask=0077"]; }; }; + swap = { + size = "8G"; + content = { + type = "swap"; + priority = 10; + discardPolicy = "both"; + }; + }; root = { size = "100%"; content = { diff --git a/hosts/ender-ml/hardware-configuration.nix b/hosts/ender-ml/hardware-configuration.nix index d7cba47..432bfaa 100644 --- a/hosts/ender-ml/hardware-configuration.nix +++ b/hosts/ender-ml/hardware-configuration.nix @@ -1,6 +1,10 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. +# Hardware profile for ender-ml (QEMU/KVM VM). +# +# Filesystems, swap, and boot-related disk config are intentionally NOT +# declared here — they are owned by disko via ./disko-config.nix, which +# sets config.fileSystems / config.swapDevices / config.boot when +# disko.enableConfig = true (the default). Keep this file limited to +# kernel modules and platform settings that disko does not manage. { config, lib, @@ -17,17 +21,5 @@ boot.kernelModules = []; boot.extraModulePackages = []; - fileSystems."/" = { - device = "/dev/disk/by-uuid/bf8d1e67-f9c0-47ef-a635-2aeef68246a6"; - fsType = "ext4"; - }; - - swapDevices = [ - { - device = "/var/lib/swapfile"; - size = 4 * 1024; - } - ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; } diff --git a/hosts/eva-01/configuration.nix b/hosts/eva-01/configuration.nix index 68ff46b..0b9b5bd 100644 --- a/hosts/eva-01/configuration.nix +++ b/hosts/eva-01/configuration.nix @@ -11,6 +11,8 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + # Declarative disk layout (consumed by disko + nixos-anywhere). + ./disko-config.nix inputs.home-manager.nixosModules.default ]; diff --git a/hosts/eva-01/disko-config.nix b/hosts/eva-01/disko-config.nix index 0e3529a..c829977 100644 --- a/hosts/eva-01/disko-config.nix +++ b/hosts/eva-01/disko-config.nix @@ -26,6 +26,14 @@ ]; }; }; + swap = { + size = "16G"; + content = { + type = "swap"; + priority = 10; + discardPolicy = "both"; + }; + }; root = { size = "100%"; content = { diff --git a/hosts/eva-01/hardware-configuration.nix b/hosts/eva-01/hardware-configuration.nix index b7bb8f4..c21c3d2 100644 --- a/hosts/eva-01/hardware-configuration.nix +++ b/hosts/eva-01/hardware-configuration.nix @@ -1,6 +1,10 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. +# Hardware profile for eva-01 (ThinkPad X1 Nano Gen 1). +# +# Filesystems, swap, and boot-related disk config are intentionally NOT +# declared here — they are owned by disko via ./disko-config.nix, which +# sets config.fileSystems / config.swapDevices / config.boot when +# disko.enableConfig = true (the default). Keep this file limited to +# kernel modules and platform settings that disko does not manage. { config, lib, @@ -17,70 +21,7 @@ boot.kernelModules = ["kvm-intel"]; boot.extraModulePackages = []; - # ── btrfs subvolumes ─────────────────────────────────────────────── - # All share the same physical device. Each subvolume can be snapshotted - # and rolled back independently. - # - # IMPORTANT: These subvolumes must exist on disk before this config is - # applied. Create them from a live USB with: - # - # mount /dev/nvme0n1pX /mnt - # btrfs subvolume create /mnt/home - # btrfs subvolume create /mnt/nix - # btrfs subvolume create /mnt/var-log - # btrfs subvolume create /mnt/snapshots - # - fileSystems."/" = { - device = "/dev/disk/by-uuid/0ec1b4fd-ca0f-4938-a038-37a69ec00b21"; - fsType = "btrfs"; - options = ["subvol=root" "compress=zstd" "discard=async" "noatime"]; - }; - - fileSystems."/home" = { - device = "/dev/disk/by-uuid/0ec1b4fd-ca0f-4938-a038-37a69ec00b21"; - fsType = "btrfs"; - options = ["subvol=home" "compress=zstd" "discard=async" "noatime"]; - }; - - fileSystems."/nix" = { - device = "/dev/disk/by-uuid/0ec1b4fd-ca0f-4938-a038-37a69ec00b21"; - fsType = "btrfs"; - options = ["subvol=nix" "compress=zstd" "discard=async" "noatime"]; - }; - - fileSystems."/var/log" = { - device = "/dev/disk/by-uuid/0ec1b4fd-ca0f-4938-a038-37a69ec00b21"; - fsType = "btrfs"; - options = ["subvol=var-log" "compress=zstd" "discard=async" "noatime"]; - neededForBoot = false; - }; - - fileSystems."/.snapshots" = { - device = "/dev/disk/by-uuid/0ec1b4fd-ca0f-4938-a038-37a69ec00b21"; - fsType = "btrfs"; - options = ["subvol=snapshots" "compress=zstd" "discard=async" "noatime"]; - neededForBoot = false; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/2066-E44D"; - fsType = "vfat"; - options = ["fmask=0077" "dmask=0077"]; - }; - - swapDevices = [ - { - device = "/var/lib/swapfile"; - size = 8 * 1024; - } - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;