From 5c7406ecc5dd63816f0d8c30bef0339f8d680390 Mon Sep 17 00:00:00 2001 From: Bert Proesmans Date: Tue, 30 Sep 2025 11:26:51 +0000 Subject: [PATCH] Fix(zfs_volume); Volume mount/unmount with encryption - Fix consistent use of fully qualified dataset path - Add idempotent unmounting with encryption keys --- lib/types/zfs_volume.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/types/zfs_volume.nix b/lib/types/zfs_volume.nix index 1095415..3f43ffa 100644 --- a/lib/types/zfs_volume.nix +++ b/lib/types/zfs_volume.nix @@ -88,8 +88,8 @@ default = { dev = '' ${lib.optionalString (config.options.keylocation or "none" != "none") '' - if [ "$(zfs get keystatus ${config.name} -H -o value)" == "unavailable" ]; then - zfs load-key ${config.name} + if [ "$(zfs get keystatus ${config._name} -H -o value)" == "unavailable" ]; then + zfs load-key ${config._name} fi ''} @@ -102,9 +102,11 @@ inherit config options; default = { dev = '' - ${lib.optionalString ( - config.options.keylocation or "none" != "none" - ) "zfs unload-key ${config.name}"} + ${lib.optionalString (config.options.keylocation or "none" != "none") '' + if [ "$(zfs get keystatus ${config._name} -H -o value)" == "available" ]; then + zfs unload-key ${config._name} + fi + ''} ${config.content._unmount.dev or ""} '';