@@ -236,165 +236,165 @@ in
236236 <filename>/dev/mapper/<replaceable>name</replaceable></filename>.
237237 '';
238238
239− type = types.loaOf types.optionSet;
240−
241− options = { name, ... }: { options = {
242−
243− name = mkOption {
244− visible = false;
245− default = name;
246− example = "luksroot";
247− type = types.str;
248− description = "Name of the unencrypted device in <filename>/dev/mapper</filename>.";
249− };
250−
251− device = mkOption {
252− example = "/dev/disk/by-uuid/430e9eff-d852-4f68-aa3b-2fa3599ebe08";
253− type = types.str;
254− description = "Path of the underlying encrypted block device.";
255− };
256−
257− header = mkOption {
258− default = null;
259− example = "/root/header.img";
260− type = types.nullOr types.str;
261− description = ''
262− The name of the file or block device that
263− should be used as header for the encrypted device.
264− '';
265− };
266−
267− keyFile = mkOption {
268− default = null;
269− example = "/dev/sdb1";
270− type = types.nullOr types.str;
271− description = ''
272− The name of the file (can be a raw device or a partition) that
273− should be used as the decryption key for the encrypted device. If
274− not specified, you will be prompted for a passphrase instead.
275− '';
276− };
277−
278− keyFileSize = mkOption {
279− default = null;
280− example = 4096;
281− type = types.nullOr types.int;
282− description = ''
283− The size of the key file. Use this if only the beginning of the
284− key file should be used as a key (often the case if a raw device
285− or partition is used as key file). If not specified, the whole
286− <literal>keyFile</literal> will be used decryption, instead of just
287− the first <literal>keyFileSize</literal> bytes.
288− '';
289− };
290−
291− # FIXME: get rid of this option.
292− preLVM = mkOption {
293− default = true;
294− type = types.bool;
295− description = "Whether the luksOpen will be attempted before LVM scan or after it.";
296− };
297−
298− allowDiscards = mkOption {
299− default = false;
300− type = types.bool;
301− description = ''
302− Whether to allow TRIM requests to the underlying device. This option
303− has security implications; please read the LUKS documentation before
304− activating it.
305− '';
306− };
307−
308− yubikey = mkOption {
309− default = null;
310− type = types.nullOr types.optionSet;
311− description = ''
312− The options to use for this LUKS device in Yubikey-PBA.
313− If null (the default), Yubikey-PBA will be disabled for this device.
314− '';
239+ type = with types; loaOf (submodule (
240+ { name, ... }: { options = {
241+
242+ name = mkOption {
243+ visible = false;
244+ default = name;
245+ example = "luksroot";
246+ type = types.str;
247+ description = "Name of the unencrypted device in <filename>/dev/mapper</filename>.";
248+ };
315249
316− options = {
317− twoFactor = mkOption {
318− default = true;
319− type = types.bool;
320− description = "Whether to use a passphrase and a Yubikey (true), or only a Yubikey (false).";
321− };
322−
323− slot = mkOption {
324− default = 2;
325− type = types.int;
326− description = "Which slot on the Yubikey to challenge.";
327− };
328−
329− saltLength = mkOption {
330− default = 16;
331− type = types.int;
332− description = "Length of the new salt in byte (64 is the effective maximum).";
333− };
334−
335− keyLength = mkOption {
336− default = 64;
337− type = types.int;
338− description = "Length of the LUKS slot key derived with PBKDF2 in byte.";
339− };
340−
341− iterationStep = mkOption {
342− default = 0;
343− type = types.int;
344− description = "How much the iteration count for PBKDF2 is increased at each successful authentication.";
345− };
346−
347− gracePeriod = mkOption {
348− default = 2;
349− type = types.int;
350− description = "Time in seconds to wait before attempting to find the Yubikey.";
351− };
352−
353− ramfsMountPoint = mkOption {
354− default = "/crypt-ramfs";
355− type = types.str;
356− description = "Path where the ramfs used to update the LUKS key will be mounted during early boot.";
357− };
358−
359− /* TODO: Add to the documentation of the current module:
360−
361− Options related to the storing the salt.
362− */
363− storage = {
364− device = mkOption {
365− default = "/dev/sda1";
366− type = types.path;
367− description = ''
368− An unencrypted device that will temporarily be mounted in stage-1.
369− Must contain the current salt to create the challenge for this LUKS device.
370− '';
371− };
250+ device = mkOption {
251+ example = "/dev/disk/by-uuid/430e9eff-d852-4f68-aa3b-2fa3599ebe08";
252+ type = types.str;
253+ description = "Path of the underlying encrypted block device.";
254+ };
372255
373− fsType = mkOption {
374− default = "vfat";
375− type = types.str;
376− description = "The filesystem of the unencrypted device.";
377− };
256+ header = mkOption {
257+ default = null;
258+ example = "/root/header.img";
259+ type = types.nullOr types.str;
260+ description = ''
261+ The name of the file or block device that
262+ should be used as header for the encrypted device.
263+ '';
264+ };
378265
379− mountPoint = mkOption {
380− default = "/crypt-storage";
381− type = types.str;
382− description = "Path where the unencrypted device will be mounted during early boot.";
383− };
266+ keyFile = mkOption {
267+ default = null;
268+ example = "/dev/sdb1";
269+ type = types.nullOr types.str;
270+ description = ''
271+ The name of the file (can be a raw device or a partition) that
272+ should be used as the decryption key for the encrypted device. If
273+ not specified, you will be prompted for a passphrase instead.
274+ '';
275+ };
276+
277+ keyFileSize = mkOption {
278+ default = null;
279+ example = 4096;
280+ type = types.nullOr types.int;
281+ description = ''
282+ The size of the key file. Use this if only the beginning of the
283+ key file should be used as a key (often the case if a raw device
284+ or partition is used as key file). If not specified, the whole
285+ <literal>keyFile</literal> will be used decryption, instead of just
286+ the first <literal>keyFileSize</literal> bytes.
287+ '';
288+ };
289+
290+ # FIXME: get rid of this option.
291+ preLVM = mkOption {
292+ default = true;
293+ type = types.bool;
294+ description = "Whether the luksOpen will be attempted before LVM scan or after it.";
295+ };
296+
297+ allowDiscards = mkOption {
298+ default = false;
299+ type = types.bool;
300+ description = ''
301+ Whether to allow TRIM requests to the underlying device. This option
302+ has security implications; please read the LUKS documentation before
303+ activating it.
304+ '';
305+ };
384306
385− path = mkOption {
386− default = "/crypt-storage/default";
387− type = types.str;
388− description = ''
389− Absolute path of the salt on the unencrypted device with
390− that device's root directory as "/".
391− '';
307+ yubikey = mkOption {
308+ default = null;
309+ description = ''
310+ The options to use for this LUKS device in Yubikey-PBA.
311+ If null (the default), Yubikey-PBA will be disabled for this device.
312+ '';
313+
314+ type = with types; nullOr (submodule {
315+ options = {
316+ twoFactor = mkOption {
317+ default = true;
318+ type = types.bool;
319+ description = "Whether to use a passphrase and a Yubikey (true), or only a Yubikey (false).";
320+ };
321+
322+ slot = mkOption {
323+ default = 2;
324+ type = types.int;
325+ description = "Which slot on the Yubikey to challenge.";
326+ };
327+
328+ saltLength = mkOption {
329+ default = 16;
330+ type = types.int;
331+ description = "Length of the new salt in byte (64 is the effective maximum).";
332+ };
333+
334+ keyLength = mkOption {
335+ default = 64;
336+ type = types.int;
337+ description = "Length of the LUKS slot key derived with PBKDF2 in byte.";
338+ };
339+
340+ iterationStep = mkOption {
341+ default = 0;
342+ type = types.int;
343+ description = "How much the iteration count for PBKDF2 is increased at each successful authentication.";
344+ };
345+
346+ gracePeriod = mkOption {
347+ default = 2;
348+ type = types.int;
349+ description = "Time in seconds to wait before attempting to find the Yubikey.";
350+ };
351+
352+ ramfsMountPoint = mkOption {
353+ default = "/crypt-ramfs";
354+ type = types.str;
355+ description = "Path where the ramfs used to update the LUKS key will be mounted during early boot.";
356+ };
357+
358+ /* TODO: Add to the documentation of the current module:
359+
360+ Options related to the storing the salt.
361+ */
362+ storage = {
363+ device = mkOption {
364+ default = "/dev/sda1";
365+ type = types.path;
366+ description = ''
367+ An unencrypted device that will temporarily be mounted in stage-1.
368+ Must contain the current salt to create the challenge for this LUKS device.
369+ '';
370+ };
371+
372+ fsType = mkOption {
373+ default = "vfat";
374+ type = types.str;
375+ description = "The filesystem of the unencrypted device.";
376+ };
377+
378+ mountPoint = mkOption {
379+ default = "/crypt-storage";
380+ type = types.str;
381+ description = "Path where the unencrypted device will be mounted during early boot.";
382+ };
383+
384+ path = mkOption {
385+ default = "/crypt-storage/default";
386+ type = types.str;
387+ description = ''
388+ Absolute path of the salt on the unencrypted device with
389+ that device's root directory as "/".
390+ '';
391+ };
392+ };
392393 };
393− };
394+ });
394395 };
395− };
396396
397− }; };
397+ }; }));
398398 };
399399
400400 boot.initrd.luks.yubikeySupport = mkOption {