2009-10-12 18:27:57 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-03-06 12:27:35 +00:00
|
|
|
|
2009-07-16 15:51:49 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-05-28 00:14:38 +01:00
|
|
|
options = {
|
|
|
|
|
2009-07-16 15:51:49 +01:00
|
|
|
swapDevices = mkOption {
|
2009-05-28 00:14:38 +01:00
|
|
|
default = [];
|
|
|
|
example = [
|
|
|
|
{ device = "/dev/hda7"; }
|
|
|
|
{ device = "/var/swapfile"; }
|
|
|
|
{ label = "bigswap"; }
|
|
|
|
];
|
2009-07-16 15:51:49 +01:00
|
|
|
description = ''
|
2009-05-28 00:14:38 +01:00
|
|
|
The swap devices and swap files. These must have been
|
|
|
|
initialised using <command>mkswap</command>. Each element
|
|
|
|
should be an attribute set specifying either the path of the
|
|
|
|
swap device or file (<literal>device</literal>) or the label
|
|
|
|
of the swap device (<literal>label</literal>, see
|
|
|
|
<command>mkswap -L</command>). Using a label is
|
|
|
|
recommended.
|
2009-07-16 15:51:49 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
type = types.list types.optionSet;
|
|
|
|
|
2009-12-26 16:20:00 +00:00
|
|
|
options = {config, options, ...}: {
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-12-26 16:20:00 +00:00
|
|
|
device = mkOption {
|
|
|
|
example = "/dev/sda3";
|
|
|
|
type = types.string;
|
2010-06-04 15:22:11 +01:00
|
|
|
description = "Path of the device.";
|
2009-12-26 16:20:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
label = mkOption {
|
|
|
|
example = "swap";
|
|
|
|
type = types.string;
|
2010-06-04 15:22:11 +01:00
|
|
|
description = ''
|
2009-12-26 16:20:00 +00:00
|
|
|
Label of the device. Can be used instead of <varname>device</varname>.
|
2010-06-04 15:22:11 +01:00
|
|
|
'';
|
2009-12-26 16:20:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cipher = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
type = types.bool;
|
2010-06-04 15:22:11 +01:00
|
|
|
description = ''
|
|
|
|
Encrypt the swap device to protect swapped data. This option
|
2009-12-31 13:56:47 +00:00
|
|
|
does not work with labels.
|
2010-06-04 15:22:11 +01:00
|
|
|
'';
|
2009-12-26 16:20:00 +00:00
|
|
|
};
|
|
|
|
|
2009-07-16 15:51:49 +01:00
|
|
|
};
|
|
|
|
|
2009-12-26 16:20:00 +00:00
|
|
|
config = {
|
|
|
|
device =
|
|
|
|
if options.label.isDefined then
|
|
|
|
"/dev/disk/by-label/${config.label}"
|
|
|
|
else
|
|
|
|
mkNotdef;
|
2009-07-16 15:51:49 +01:00
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-07-16 15:51:49 +01:00
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-05-28 00:14:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2009-07-16 15:51:49 +01:00
|
|
|
|
2006-12-21 01:07:23 +00:00
|
|
|
}
|