refactor: update rollback system service for zfs and disable forceImportRoot
This commit is contained in:
parent
1c541cf9dd
commit
17c70f32d2
2 changed files with 20 additions and 5 deletions
|
|
@ -1,5 +1,9 @@
|
|||
{pkgs, ...}: {
|
||||
boot.supportedFilesystems = ["ntfs" "zfs" "nfs"];
|
||||
boot = {
|
||||
supportedFilesystems = ["ntfs" "zfs" "nfs"];
|
||||
|
||||
zfs.forceImportRoot = false;
|
||||
};
|
||||
|
||||
services.davfs2.enable = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
namespace,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) types mkIf mkEnableOption mkOption mkAfter concatLists;
|
||||
inherit (lib) types mkIf mkEnableOption mkOption concatLists;
|
||||
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
||||
base = "${namespace}.services.storage.impermanence";
|
||||
cfg = getAttrByNamespace config base;
|
||||
|
|
@ -49,9 +49,20 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
|
||||
boot.initrd.postResumeCommands = mkAfter ''
|
||||
zfs rollback -r zroot/root@blank
|
||||
'';
|
||||
boot.initrd.systemd.services.rollback = {
|
||||
description = "Rollback ZFS root to blank snapshot";
|
||||
wantedBy = ["initrd.target"];
|
||||
after = ["zfs-import-zroot.service"];
|
||||
before = ["sysroot.mount"];
|
||||
path = [config.boot.zfs.package];
|
||||
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
|
||||
script = ''
|
||||
zfs rollback -r zroot/root@blank
|
||||
'';
|
||||
};
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue