qol(Hibernate/Sleep): Now works 🎉
This commit is contained in:
@@ -126,11 +126,12 @@ in
|
|||||||
# Enable this if you have graphical corruption issues or application crashes after waking
|
# Enable this if you have graphical corruption issues or application crashes after waking
|
||||||
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
||||||
# of just the bare essentials.
|
# of just the bare essentials.
|
||||||
powerManagement.enable = false;
|
powerManagement.enable = true;
|
||||||
|
|
||||||
# Fine-grained power management. Turns off GPU when not in use.
|
# Fine-grained power management. Turns off GPU when not in use.
|
||||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||||
powerManagement.finegrained = false;
|
powerManagement.finegrained = false;
|
||||||
|
# prime.offload.enable = true;
|
||||||
|
|
||||||
# Use the NVidia open source kernel module (not to be confused with the
|
# Use the NVidia open source kernel module (not to be confused with the
|
||||||
# independent third-party "nouveau" open source driver).
|
# independent third-party "nouveau" open source driver).
|
||||||
|
|||||||
@@ -7,6 +7,18 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.modules.Hyprland;
|
cfg = config.modules.Hyprland;
|
||||||
|
suspend = pkgs.writeShellScript "hyprland_suspend" ''
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
suspend)
|
||||||
|
killall -STOP Hyprland
|
||||||
|
;;
|
||||||
|
resume)
|
||||||
|
killall -CONT Hyprland
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@@ -17,7 +29,9 @@ in
|
|||||||
options.modules.Hyprland = {
|
options.modules.Hyprland = {
|
||||||
enable = lib.mkEnableOption "Hyprland";
|
enable = lib.mkEnableOption "Hyprland";
|
||||||
};
|
};
|
||||||
config.wayland.windowManager.hyprland = lib.mkIf cfg.enable {
|
# TODO, split this into its own module;
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# set the flake package
|
# set the flake package
|
||||||
# settings = { };
|
# settings = { };
|
||||||
@@ -26,8 +40,7 @@ in
|
|||||||
portalPackage =
|
portalPackage =
|
||||||
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
||||||
};
|
};
|
||||||
# TODO, split this into its own module;
|
programs = {
|
||||||
config.programs = lib.mkIf cfg.enable {
|
|
||||||
wlogout = {
|
wlogout = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
@@ -46,4 +59,46 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
systemd.user.services."hyprland_suspend" = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Suspend hyprland";
|
||||||
|
Before = [
|
||||||
|
"systemd-suspend.service"
|
||||||
|
"systemd-hibernate.service"
|
||||||
|
"nvidia-suspend.service"
|
||||||
|
"nvidia-hibernate.service"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
Install = {
|
||||||
|
WantedBy = [
|
||||||
|
"systemd-suspend.service"
|
||||||
|
"systemd-hibernate.service"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
Service = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${suspend} suspend";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
systemd.user.services."hyprland_resume" = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Resume hyprland";
|
||||||
|
After = [
|
||||||
|
"systemd-suspend.service"
|
||||||
|
"systemd-hibernate.service"
|
||||||
|
"nvidia-resume.service"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
Install = {
|
||||||
|
WantedBy = [
|
||||||
|
"systemd-suspend.service"
|
||||||
|
"systemd-hibernate.service"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
Service = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${suspend} resume";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,19 @@ in
|
|||||||
};
|
};
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
programs.xwayland.enable = true;
|
programs.xwayland.enable = true;
|
||||||
|
boot.kernelParams = [
|
||||||
|
"resume=UUID=d9b81619-5772-4ac4-bcd5-552e1e784f9e"
|
||||||
|
"resume_offset=141042944"
|
||||||
|
];
|
||||||
|
boot.resumeDevice = "/dev/disk/by-uuid/d9b81619-5772-4ac4-bcd5-552e1e784f9e";
|
||||||
|
powerManagement.enable = true;
|
||||||
|
swapDevices = [
|
||||||
|
# [[ Hibernate ]]
|
||||||
|
{
|
||||||
|
device = "/var/lib/swapfile";
|
||||||
|
size = 48 * 1024; # 48GB in MB
|
||||||
|
}
|
||||||
|
];
|
||||||
programs.hyprland = {
|
programs.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# set the flake package
|
# set the flake package
|
||||||
|
|||||||
Reference in New Issue
Block a user