fix: boot issues

nixos
Moritz Böhme 2024-10-24 11:49:05 +02:00
parent 4d2577e8eb
commit 14007ca4f8
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
1 changed files with 22 additions and 4 deletions

View File

@ -1,4 +1,4 @@
{ lib, ... }:
{ lib, pkgs, ... }:
{
# needed for zfs pool
@ -83,9 +83,27 @@
};
};
# rollback to blank
boot.initrd.postDeviceCommands = lib.mkAfter ''
boot.initrd.systemd.services.rollback = {
description = "Rollback ZFS datasets to a pristine state";
wantedBy = [
"initrd.target"
];
after = [
"zfs-import-zroot.service"
];
before = [
"sysroot.mount"
];
path = with pkgs; [
zfs
];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
zfs rollback -r zroot/encrypted/root@blank && echo "rollback complete"
'';
};
boot.initrd.systemd.enable = true;
fileSystems."/persist".neededForBoot = true;
# HACK: to fix issue of agenix running before impermanence
age.identityPaths = [