From 9f9ff673d126858bc8de6f0c08f9d1b1adcc1097 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 19 Dec 2023 23:49:30 +1100 Subject: [PATCH] zpool: fix default dataset getting shadowed If the zpool's root dataset is not the rootfs and gets mounted on creation, the actual rootfs will get mounted later and shadow the current mountpoint. Running `zfs unmount` is the easiest way to unmount the zpool's root dataset on creation without messing up the value of the `mountpoint` setting. --- lib/types/zpool.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/types/zpool.nix b/lib/types/zpool.nix index 0bf97c9..7654ca5 100644 --- a/lib/types/zpool.nix +++ b/lib/types/zpool.nix @@ -67,6 +67,9 @@ ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \ ${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-O ${n}=${v}") config.rootFsOptions)} \ "''${zfs_devices[@]}" + ${lib.optionalString ((config.rootFsOptions.mountpoint or "") != "none") '' + zfs unmount ${config.name} + ''} ${lib.concatMapStrings (dataset: dataset._create) (lib.attrValues config.datasets)} ''; };