From 605b2d09c6473e611e42c5d6adcc9f97f2e495b3 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Mon, 23 Oct 2023 16:57:07 -0400 Subject: [PATCH] polaris: Put the system root back on a zfs volume * Root on tmpfs was limiting the size avaible for nix builds. * Now using service to "zfs rollback" to blank root after zfs import and before mounting root. --- module/polaris.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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;