From 25065e5bd7ae50dc16d662555c15c25e658d4043 Mon Sep 17 00:00:00 2001 From: Cy Pokhrel Date: Fri, 22 Nov 2024 19:18:02 -0500 Subject: [PATCH] make hibernate work --- nix/configuration.nix | 41 ++++++++++++++++++---------------- nix/hardware-configuration.nix | 19 ++++++++++++---- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/nix/configuration.nix b/nix/configuration.nix index d74a72e..6db0524 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -11,12 +11,12 @@ networking.hostName = "ytnix"; networking.networkmanager.enable = true; - # disable 2.4 GHz cause i have a shitty wireless card - # that interferes with bluetooth otherwise networking.wireless.iwd = { enable = true; settings = { Rank = { + # disable 2.4 GHz cause i have a shitty wireless card + # that interferes with bluetooth otherwise BandModifier2_4GHz = 0.0; }; }; @@ -49,6 +49,8 @@ fastfetch discord nwg-look + element-desktop-wayland + kdePackages.gwenview ]; }; @@ -79,6 +81,8 @@ libimobiledevice networkmanagerapplet pass-wayland + htop + file ]; system.stateVersion = "24.05"; @@ -93,7 +97,7 @@ }; programs.waybar.enable = true; programs.zsh.enable = true; - security.sudo.wheelNeedsPassword = false; + # security.sudo.wheelNeedsPassword = false; fonts.packages = with pkgs; [ nerdfonts @@ -127,6 +131,7 @@ "**/.steam" "**/.rustup" "**/.docker" + "**/.snapshots" ]; repo = "de3911@de3911.rsync.net:borg/yt"; encryption = { @@ -141,24 +146,22 @@ startAt = "hourly"; }; }; + services.btrbk.instances.local.settings = { + snapshot_preserve = "14d 52w"; + snapshot_preserve_min = "2d"; + volume."/" = { + target = "/snapshots"; + subvolume = { + home = {}; + "/" = {}; + }; + }; + }; programs.steam.enable = true; - services.snapper.configs = { - home = { - SUBVOLUME = "/home"; - ALLOW_USERS = [ "yt" ]; - TIMELINE_CREATE = true; - TIMELINE_CLEANUP = true; - TIMELINE_LIMIT_HOURLY = 48; - TIMELINE_LIMIT_WEEKLY = 52; - }; - root = { - SUBVOLUME = "/"; - TIMELINE_CREATE = true; - TIMELINE_CLEANUP = true; - TIMELINE_LIMIT_HOURLY = 48; - TIMELINE_LIMIT_WEEKLY = 52; - }; + services.logind = { + lidSwitch = "hibernate"; + suspendKey = "hibernate"; }; } diff --git a/nix/hardware-configuration.nix b/nix/hardware-configuration.nix index 364f972..3277d8c 100644 --- a/nix/hardware-configuration.nix +++ b/nix/hardware-configuration.nix @@ -16,7 +16,7 @@ fileSystems."/" = { device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; fsType = "btrfs"; - options = [ "subvol=root" ]; + options = [ "subvol=root" "compress=zstd" ]; }; boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/c6098a16-c8a6-4a97-8648-6f46ca919d13"; @@ -24,13 +24,19 @@ fileSystems."/home" = { device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; fsType = "btrfs"; - options = [ "subvol=home" ]; + options = [ "subvol=home" "compress=zstd" ]; }; fileSystems."/nix" = { device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; fsType = "btrfs"; - options = [ "subvol=nix" ]; + options = [ "subvol=nix" "compress=zstd" "noatime" ]; + }; + + fileSystems."/swap" = + { device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; + fsType = "btrfs"; + options = [ "subvol=swap" ]; }; fileSystems."/boot" = @@ -39,7 +45,12 @@ options = [ "fmask=0022" "dmask=0022" ]; }; - swapDevices = [ ]; + swapDevices = [ { + device = "/swap/swapfile"; + } ]; + + boot.resumeDevice = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; + boot.kernelParams = [ "resume_offset=53224704" ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's