Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

polaris: Put the system root back on a zfs volume #114

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions module/polaris.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;

Expand Down