Enable hibernation on thinker

This commit is contained in:
Daniel Flanagan 2023-11-21 10:14:58 -06:00
parent ceace24dae
commit 1675f40ec3
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
4 changed files with 45 additions and 11 deletions

View file

@ -1,4 +1,6 @@
{outputs, ...}: {
{outputs, ...}: let
scale = 1.5;
in {
imports = with outputs.homeManagerModules; [
sway
sway-laptop
@ -9,7 +11,7 @@
settings = {
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
monitor = [
"eDP-1,2256x1504@60,0x0,1.5"
"eDP-1,2256x1504@60,0x0,${toString scale}"
];
};
};
@ -19,7 +21,7 @@
output = {
"BOE 0x0BCA Unknown" = {
mode = "2256x1504@60Hz";
scale = "1.25";
scale = toString scale;
};
};
};

View file

@ -2,5 +2,6 @@
imports = with outputs.homeManagerModules; [
sway
sway-laptop
hyprland
];
}

View file

@ -26,6 +26,17 @@
# TODO: hibernation? does sleep suffice?
services.fwupd.enable = true;
services.fwupd.extraRemotes = ["lvfs-testing"];
hardware.opengl.extraPackages = [
pkgs.rocmPackages.clr.icd
pkgs.amdvlk
# encoding/decoding acceleration
pkgs.libvdpau-va-gl
pkgs.vaapiVdpau
];
hardware.wirelessRegulatoryDatabase = true;
boot = {
@ -38,8 +49,8 @@
kernelParams = [
"amdgpu.sg_display=0"
"acpi_osi=\"!Windows 2020\""
# "nvme.noacpi=1" # maybe causing crashes?
"rtc_cmos.use_acpi_alarm=1"
# "nvme.noacpi=1" # maybe causing crashes upon waking?
# "rtc_cmos.use_acpi_alarm=1" # maybe causing excessive battery drain while sleeping -- perhaps due to waking?
];
initrd.availableKernelModules = ["xhci_pci" "nvme" "thunderbolt"];
kernelModules = ["kvm-amd"];

View file

@ -9,6 +9,27 @@
}: {
networking.hostName = "thinker";
swapDevices = [
# TODO: move this to disko?
# sudo btrfs subvolume create /swap
# sudo btrfs filesystem mkswapfile --size 32g --uuid clear /swap/swapfile
# sudo swapon /swap/swapfile
{device = "/swap/swapfile";}
];
# findmnt -no UUID -T /swap/swapfile
boot.resumeDevice = "/dev/disk/by-uuid/aacd6814-a5a2-457a-bf65-8d970cb1f03d";
services.logind = {
lidSwitch = "suspend-then-hibernate";
extraConfig = ''
HandlePowerKey=suspend-then-hibernate
IdleAction=suspend-then-hibernate
IdleActionSec=1m
'';
};
systemd.sleep.extraConfig = "HibernateDelaySec=30m";
imports =
[
inputs.disko.nixosModules.disko
@ -26,17 +47,16 @@
# ./relative-module.nix
];
# TODO: hibernation? I've been using [deep] in /sys/power/mem_sleep alright
# with this machine so it may not be necessary?
# need to measure percentage lost per day, but I think it's around 10%/day
# it looks like I may have had hibernation working -- see ../old/third.nix
boot = {
loader = {
efi.canTouchEfiVariables = true;
systemd-boot.enable = true;
};
kernelParams = ["boot.shell_on_fail"];
# sudo filefrag -v /swap/swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}'
# the above won't work for btrfs, instead you need
# btrfs inspect-internal map-swapfile -r /swap/swapfile
# https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file
kernelParams = ["boot.shell_on_fail" "resume_offset=22816000"];
initrd.availableKernelModules = ["xhci_pci" "nvme" "ahci"];
};
hardware.bluetooth.enable = true;