From 436fd911cfb55b844988f290f2b00b4e8af59d6a Mon Sep 17 00:00:00 2001 From: Bert Proesmans Date: Tue, 30 Sep 2025 11:20:57 +0000 Subject: [PATCH] Fix(zfs_fs); Mount/Unmount with encryption - Fix typo against full dataset path argument - Make unmount with encryption keys idempotent --- lib/types/zfs_fs.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/types/zfs_fs.nix b/lib/types/zfs_fs.nix index 129ddf5..37e1c6f 100644 --- a/lib/types/zfs_fs.nix +++ b/lib/types/zfs_fs.nix @@ -143,7 +143,11 @@ inherit config options; default = (lib.optionalAttrs (config.options.keylocation or "none" != "none") { - dev = "zfs unload-key ${config.name}"; + dev = '' + if [ "$(zfs get keystatus ${config._name} -H -o value)" == "available" ]; then + zfs unload-key ${config._name} + fi + ''; }) // lib.optionalAttrs (config.options.mountpoint or "" != "none" && config.options.canmount or "" != "off")