diff --git a/module/polaris.nix b/module/polaris.nix index 3bf2c3c..1246b1a 100644 --- a/module/polaris.nix +++ b/module/polaris.nix @@ -22,6 +22,12 @@ in boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "uas" "usbhid" "sd_mod" ]; + fileSystems."/" = + { + device = "mainpool/local/root"; + fsType = "zfs"; + }; + fileSystems."/nix" = { device = "mainpool/local/nix"; @@ -47,6 +53,27 @@ in fsType = "vfat"; }; + boot.initrd.systemd.services.rollback = { + description = "Rollback ZFS datasets to a pristine state"; + wantedBy = [ + "initrd.target" + ]; + after = [ + "zfs-import-mainpool.service" + ]; + before = [ + "sysroot.mount" + ]; + path = with pkgs; [ + zfs + ]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + script = '' + zfs rollback -r mainpool/local/root@blank && echo "rollback complete" + ''; + }; + boot.plymouth.enable = true; boot.zfs.forceImportRoot = false;