{ config, pkgs, ... }: with pkgs.lib; { ###### interface options = { swapDevices = mkOption { default = []; example = [ { device = "/dev/hda7"; } { device = "/var/swapfile"; } { label = "bigswap"; } ]; description = '' The swap devices and swap files. These must have been initialised using mkswap. Each element should be an attribute set specifying either the path of the swap device or file (device) or the label of the swap device (label, see mkswap -L). Using a label is recommended. ''; type = types.list types.optionSet; options = {config, options, ...}: { options = { device = mkOption { example = "/dev/sda3"; type = types.uniq types.string; description = "Path of the device."; }; label = mkOption { example = "swap"; type = types.uniq types.string; description = '' Label of the device. Can be used instead of device. ''; }; size = mkOption { default = null; example = "swap"; type = types.nullOr types.int; description = '' Label of the device. Can be used instead of device. ''; }; }; config = { device = if options.label.isDefined then "/dev/disk/by-label/${config.label}" else mkNotdef; }; }; }; }; }