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
|
||||
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
||||
# of just the bare essentials.
|
||||
powerManagement.enable = false;
|
||||
powerManagement.enable = true;
|
||||
|
||||
# Fine-grained power management. Turns off GPU when not in use.
|
||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||
powerManagement.finegrained = false;
|
||||
# prime.offload.enable = true;
|
||||
|
||||
# Use the NVidia open source kernel module (not to be confused with the
|
||||
# independent third-party "nouveau" open source driver).
|
||||
|
||||
@@ -7,6 +7,18 @@
|
||||
}:
|
||||
let
|
||||
cfg = config.modules.Hyprland;
|
||||
suspend = pkgs.writeShellScript "hyprland_suspend" ''
|
||||
#!/bin/bash
|
||||
|
||||
case "$1" in
|
||||
suspend)
|
||||
killall -STOP Hyprland
|
||||
;;
|
||||
resume)
|
||||
killall -CONT Hyprland
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -17,33 +29,76 @@ in
|
||||
options.modules.Hyprland = {
|
||||
enable = lib.mkEnableOption "Hyprland";
|
||||
};
|
||||
config.wayland.windowManager.hyprland = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
# set the flake package
|
||||
# settings = { };
|
||||
systemd.variables = [ "--all" ];
|
||||
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
||||
portalPackage =
|
||||
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
||||
};
|
||||
# TODO, split this into its own module;
|
||||
config.programs = lib.mkIf cfg.enable {
|
||||
wlogout = {
|
||||
config = lib.mkIf cfg.enable {
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
# set the flake package
|
||||
# settings = { };
|
||||
systemd.variables = [ "--all" ];
|
||||
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
||||
portalPackage =
|
||||
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
||||
};
|
||||
foot = {
|
||||
enable = true;
|
||||
settings = {
|
||||
main = {
|
||||
term = "xterm-256color";
|
||||
programs = {
|
||||
wlogout = {
|
||||
enable = true;
|
||||
};
|
||||
foot = {
|
||||
enable = true;
|
||||
settings = {
|
||||
main = {
|
||||
term = "xterm-256color";
|
||||
|
||||
font = "CaskaydiaCove Nerd Font Mono:size=12";
|
||||
};
|
||||
font = "CaskaydiaCove Nerd Font Mono:size=12";
|
||||
};
|
||||
|
||||
mouse = {
|
||||
hide-when-typing = "yes";
|
||||
mouse = {
|
||||
hide-when-typing = "yes";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
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 {
|
||||
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 = {
|
||||
enable = true;
|
||||
# set the flake package
|
||||
|
||||
Reference in New Issue
Block a user