Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
polaris: Put the system root back on a zfs volume
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Rosuavio committed Oct 23, 2023
1 parent bd70f1e commit 605b2d0
Showing 1 changed file with 27 additions and 0 deletions.
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

0 comments on commit 605b2d0

Please sign in to comment.