# Is it possible to hibernate with swap-file?

**URL:** https://discourse.nixos.org/t/is-it-possible-to-hibernate-with-swap-file/2852
**Category:** Help
**Created:** [May 5, 2019, 5:27pm UTC](https://discourse.nixos.org/t/is-it-possible-to-hibernate-with-swap-file/2852 "2019-05-05T17:27:19Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![Granddave](https://discourse.nixos.org/user_avatar/discourse.nixos.org/granddave/32/29822_2.png) [@Granddave](https://discourse.nixos.org/u/Granddave)
#### Post date: [December 17, 2024, 4:18pm UTC](https://discourse.nixos.org/t/is-it-possible-to-hibernate-with-swap-file/2852/7 "2024-12-17T16:18:27Z")

</div>

Can also confirm, got hibernation working with this config on 24.11:

```nix
  boot.initrd.systemd.enable = true;
  swapDevices = [{
    device = "/var/lib/swapfile";
    size = 32 * 1024;
  }];

```

---

_[View the full topic](https://discourse.nixos.org/t/is-it-possible-to-hibernate-with-swap-file/2852)._
