From 6760c5ba9ecce09a037d4d9a792c6bc61713872a Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 21 Nov 2023 10:36:19 -0600 Subject: [PATCH] Add hibernation to foxtrot --- modules/home-manager/broot.nix | 19 ++++++++++++++++++- nixos/foxtrot/default.nix | 26 +++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/modules/home-manager/broot.nix b/modules/home-manager/broot.nix index d8a0bc5..60b3da8 100644 --- a/modules/home-manager/broot.nix +++ b/modules/home-manager/broot.nix @@ -1,4 +1,4 @@ -{...}: { +{colors, ...}: { programs.broot = { enable = true; enableFishIntegration = true; @@ -12,6 +12,23 @@ execution = "$EDITOR {file}"; } ]; + + skin = with colors.withHashPrefix; { + status_normal_fg = fg; + status_normal_bg = bg; + status_error_fg = red; + status_error_bg = yellow; + tree_fg = red; + selected_line_bg = bg2; + permissions_fg = purple; + size_bar_full_bg = red; + size_bar_void_bg = bg; + directory_fg = yellow; + input_fg = blue; + flag_value_fg = yellow; + table_border_fg = red; + code_fg = yellow; + }; }; }; } diff --git a/nixos/foxtrot/default.nix b/nixos/foxtrot/default.nix index 9d6dc9d..a355864 100644 --- a/nixos/foxtrot/default.nix +++ b/nixos/foxtrot/default.nix @@ -24,7 +24,26 @@ inputs.hardware.nixosModules.framework-13-7040-amd ]; - # TODO: hibernation? does sleep suffice? + 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/3076912c-ac61-4067-b6b2-361f68b2d038"; + + services.logind = { + lidSwitch = "suspend-then-hibernate"; + extraConfig = '' + HandlePowerKey=suspend-then-hibernate + IdleAction=suspend-then-hibernate + IdleActionSec=1m + ''; + }; + systemd.sleep.extraConfig = "HibernateDelaySec=30m"; services.fwupd.enable = true; services.fwupd.extraRemotes = ["lvfs-testing"]; @@ -45,10 +64,15 @@ systemd-boot.enable = true; }; kernelPackages = pkgs.linuxPackages_6_5; + # 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 # many of these come from https://wiki.archlinux.org/title/Framework_Laptop_13#Suspend kernelParams = [ "amdgpu.sg_display=0" "acpi_osi=\"!Windows 2020\"" + "resume_offset=39331072" # "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? ];