···137137 awkCmd = "${pkgs.gawk}/bin/awk";
138138 inherit cfgZfs;
139139 }) + ''
140140- poolImported "${pool}" && exit
141141- echo -n "importing ZFS pool \"${pool}\"..."
142142- # Loop across the import until it succeeds, because the devices needed may not be discovered yet.
143143- for trial in `seq 1 60`; do
144144- poolReady "${pool}" && poolImport "${pool}" && break
145145- sleep 1
146146- done
147147- poolImported "${pool}" || poolImport "${pool}" # Try one last time, e.g. to import a degraded pool.
140140+ if ! poolImported "${pool}"; then
141141+ echo -n "importing ZFS pool \"${pool}\"..."
142142+ # Loop across the import until it succeeds, because the devices needed may not be discovered yet.
143143+ for trial in `seq 1 60`; do
144144+ poolReady "${pool}" && poolImport "${pool}" && break
145145+ sleep 1
146146+ done
147147+ poolImported "${pool}" || poolImport "${pool}" # Try one last time, e.g. to import a degraded pool.
148148+ fi
148149 if poolImported "${pool}"; then
149150 ${optionalString keyLocations.hasKeys ''
150151 ${keyLocations.command} | while IFS=$'\t' read ds kl ks; do
···159160 tries=3
160161 success=false
161162 while [[ $success != true ]] && [[ $tries -gt 0 ]]; do
162162- ${systemd}/bin/systemd-ask-password "Enter key for $ds:" | ${cfgZfs.package}/sbin/zfs load-key "$ds" \
163163+ ${systemd}/bin/systemd-ask-password --timeout=${toString cfgZfs.passwordTimeout} "Enter key for $ds:" | ${cfgZfs.package}/sbin/zfs load-key "$ds" \
163164 && success=true \
164165 || tries=$((tries - 1))
165166 done
···310311 are requested. To only decrypt selected datasets supply a list of dataset
311312 names instead. For root pools the encryption key can be supplied via both
312313 an interactive prompt (keylocation=prompt) and from a file (keylocation=file://).
314314+ '';
315315+ };
316316+317317+ passwordTimeout = mkOption {
318318+ type = types.int;
319319+ default = 0;
320320+ description = lib.mdDoc ''
321321+ Timeout in seconds to wait for password entry for decrypt at boot.
322322+323323+ Defaults to 0, which waits forever.
313324 '';
314325 };
315326 };