Skip to content

Commit

Permalink
zfs: add option to save encryption credentials in kernel keyring
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawn8901 committed Dec 4, 2024
1 parent be3f2a4 commit 58b36ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nixos/modules/tasks/filesystems/zfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ let
tries=3
success=false
while [[ $success != true ]] && [[ $tries -gt 0 ]]; do
${systemd}/bin/systemd-ask-password --timeout=${toString cfgZfs.passwordTimeout} "Enter key for $ds:" | ${cfgZfs.package}/sbin/zfs load-key "$ds" \
${systemd}/bin/systemd-ask-password ${lib.optionalString cfgZfs.storeEncryptionCredentials("--keyname=zfs-$ds")} --timeout=${toString cfgZfs.passwordTimeout} "Enter key for $ds:" | ${cfgZfs.package}/sbin/zfs load-key "$ds" \
&& success=true \
|| tries=$((tries - 1))
done
Expand Down Expand Up @@ -322,6 +322,8 @@ in
'';
};

storeEncryptionCredentials = lib.mkEnableOption "Stores the encryption credentials in kernel keyring with keyname=zfs-<poolame>";

passwordTimeout = lib.mkOption {
type = lib.types.int;
default = 0;
Expand Down

0 comments on commit 58b36ed

Please sign in to comment.