From 507447201771f9e3cc6b409159de590174130c91 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 18 Jan 2024 08:54:14 +0100 Subject: [PATCH] Auto rollback zfs on boot --- hosts/nixos/lapetus/filesystems/zfs.nix | 28 ++++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/hosts/nixos/lapetus/filesystems/zfs.nix b/hosts/nixos/lapetus/filesystems/zfs.nix index 54fce85..d448ef3 100644 --- a/hosts/nixos/lapetus/filesystems/zfs.nix +++ b/hosts/nixos/lapetus/filesystems/zfs.nix @@ -8,20 +8,18 @@ in boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; boot.kernelParams = [ "nohibernate" ]; - boot.initrd.systemd.services = { - # # {{{ Rollback - # rollback = { - # path = [ pkgs.zfs ]; - # serviceConfig = { - # Type = "oneshot"; - # RemainAfterExit = true; - # }; - # unitConfig.DefaultDependencies = "no"; - # wantedBy = [ "initrd.target" ]; - # after = [ "zfs-import.target" ]; - # before = [ "sysroot.mount" ]; - # script = "zfs rollback -r zroot@blank"; - # }; - # # }}} + # {{{ Rollback + boot.initrd.systemd.services.rollback = { + path = [ pkgs.zfs ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + unitConfig.DefaultDependencies = "no"; + wantedBy = [ "initrd.target" ]; + after = [ "zfs-import.target" ]; + before = [ "sysroot.mount" ]; + script = "zfs rollback -r zroot@blank"; }; + # }}} }