24 lines
393 B
Nix
24 lines
393 B
Nix
|
{ config, lib, ... }:
|
||
|
let
|
||
|
cfg = config.custom.hibernate;
|
||
|
in
|
||
|
{
|
||
|
options.custom.hibernate.enable = lib.mkOption {
|
||
|
type = lib.types.bool;
|
||
|
default = false;
|
||
|
};
|
||
|
|
||
|
config = lib.mkIf cfg.enable {
|
||
|
swapDevices = [
|
||
|
{
|
||
|
device = "/var/lib/swapfile";
|
||
|
size = 16 * 1024;
|
||
|
}
|
||
|
];
|
||
|
|
||
|
boot = {
|
||
|
resumeDevice = lib.mkDefault "/dev/mapper/nixos";
|
||
|
};
|
||
|
};
|
||
|
}
|