aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/disks/default.nix22
-rw-r--r--system/disks/hibernate.nix26
2 files changed, 25 insertions, 23 deletions
diff --git a/system/disks/default.nix b/system/disks/default.nix
index 71a43667..28797f2c 100644
--- a/system/disks/default.nix
+++ b/system/disks/default.nix
@@ -108,20 +108,22 @@ in {
};
};
swapDevices = [
- {
- device = "/swap/swapfile";
- priority = 1; # lower than zramSwap, just in case
- # size = 2048; # TODO can nixos create a btrfs swapfile correctly?
- }
+ #{
+ # device = "/swap/swapfile";
+ # priority = 1; # lower than zramSwap, just in case
+ # # size = 2048; # TODO can nixos create a btrfs swapfile correctly?
+ #}
];
zramSwap = {
enable = true;
priority = 10; # needs to be higher than hardware-swap
};
- boot.kernelParams = [
- "resume=UUID=${cfg.swap.uuid}"
- "resume_offset=${cfg.swap.resumeOffset}"
- "zswap.enabled=0" # zswap and zram are not really compatible
- ];
+ boot = {
+ kernelParams = [
+ "resume_offset=${cfg.swap.resumeOffset}"
+ "zswap.enabled=0" # zswap and zram are not really compatible
+ ];
+ resumeDevice = "/dev/disk/by-uuid/${cfg.swap.uuid}";
+ };
};
}
diff --git a/system/disks/hibernate.nix b/system/disks/hibernate.nix
index 26dd223a..e6d989f2 100644
--- a/system/disks/hibernate.nix
+++ b/system/disks/hibernate.nix
@@ -10,11 +10,11 @@
serviceConfig = {
Type = "oneshot";
User = "root";
- ExecStart = "${pkgs.dash}/bin/dash -c \"${pkgs.util-linux}/bin/swapon /swap/swapfile && ${pkgs.util-linux}/bin/swapoff /dev/zram0\"";
+ ExecStart = "${pkgs.bash}/bin/bash -c \"${pkgs.util-linux}/bin/swapon /swap/swapfile && ${pkgs.util-linux}/bin/swapoff /dev/zram0\"";
};
};
hibernate-resume = {
- wantedBy = ["hibernate.target"];
+ wantedBy = ["systemd-hibernate.service"];
unitConfig = {
Description = "Disable swap after resuming from hibernation";
After = "hibernate.target";
@@ -25,17 +25,17 @@
ExecStart = "${pkgs.util-linux}/bin/swapoff /swap/swapfile";
};
};
- swapoff-start = {
- wantedBy = ["multi-user.target"];
- unitConfig = {
- Description = "Disable hardware swap after booting";
- };
- serviceConfig = {
- Type = "oneshot";
- User = "root";
- ExecStart = "${pkgs.util-linux}/bin/swapoff /swap/swapfile";
- };
- };
+ # swapoff-start = {
+ # wantedBy = ["multi-user.target"];
+ # unitConfig = {
+ # Description = "Disable hardware swap after booting";
+ # };
+ # serviceConfig = {
+ # Type = "oneshot";
+ # User = "root";
+ # ExecStart = "${pkgs.util-linux}/bin/swapoff /swap/swapfile";
+ # };
+ # };
systemd-hibernate.serviceConfig.Environment = "SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1";
systemd-logind.serviceConfig.Environment = "SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1";
};