From 7d1436ac5440deb68f4f7872570036d28ab61855 Mon Sep 17 00:00:00 2001 From: minco Date: Fri, 8 May 2026 14:40:12 +0900 Subject: [PATCH] 1 --- configuration.nix | 33 +++++++++++++++++++++++++++- flake.lock | 12 +++++------ hardware-configuration.nix | 44 ++++++++++++++++++++------------------ pkgs/util.nix | 1 + 4 files changed, 62 insertions(+), 28 deletions(-) diff --git a/configuration.nix b/configuration.nix index 2719bc2..d8480a3 100644 --- a/configuration.nix +++ b/configuration.nix @@ -15,7 +15,38 @@ in { ./programs/hyprland.nix ]; - services.logind.lidSwitch = "suspend"; + services.logind = { + lidSwitch = "suspend-then-hibernate"; + lidSwitchExternalPower = "suspend"; + lidSwitchDocked = "ignore"; + powerKey = "poweroff"; + powerKeyLongPress = "poweroff"; + }; + + systemd.sleep.extraConfig = '' + HibernateDelaySec=30min + SuspendState=mem + ''; + + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_BOOST_ON_BAT = 0; + CPU_BOOST_ON_AC = 1; + PLATFORM_PROFILE_ON_AC = "performance"; + PLATFORM_PROFILE_ON_BAT = "low-power"; + START_CHARGE_THRESH_BAT0 = 75; + STOP_CHARGE_THRESH_BAT0 = + 80; # remove these two if your laptop doesn't support charge thresholds + }; + }; + powerManagement.enable = true; + + services.power-profiles-daemon.enable = false; nixpkgs.config.allowUnfree = true; diff --git a/flake.lock b/flake.lock index b02aa72..52d6fe8 100644 --- a/flake.lock +++ b/flake.lock @@ -187,11 +187,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1778165951, - "narHash": "sha256-3pTCdJ6k64iLdE86fDxHi6TWdEHOwvQRP4B4N/5ARRE=", + "lastModified": 1778199997, + "narHash": "sha256-vmCYnK7/iRQGWj+s0l3+cf/IVoUcCTrlFtgUCTwRdjU=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "acba1c440b4e5b23338b068611710ee8e3fb8d54", + "rev": "de9f8dc9831d921cd1ee30d5d14f45f0e345a8ca", "type": "github" }, "original": { @@ -364,11 +364,11 @@ ] }, "locked": { - "lastModified": 1777492286, - "narHash": "sha256-PwuoEJQcjSKJNP5T55qhfDwIP0tw5zxEhfu8GDfKfeg=", + "lastModified": 1778179779, + "narHash": "sha256-Ri6rVf54CRD3aISHLhSY6H4tBScVjm9ebkv7rF2lcZM=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "ec5c0c709706bad5b82f667fd8758eae442577ce", + "rev": "3e170e5ad010602671f5f25b327e8bdb8fdd532c", "type": "github" }, "original": { diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 9400f4f..01fbb31 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -4,11 +4,10 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.kernelParams = [ "quiet" "modprobe.blacklist=dvb_usb_rtl28xxu" ]; @@ -20,26 +19,28 @@ options = [ "size=8G" "mode=1777" ]; }; - fileSystems."/" = - { device = "/dev/disk/by-uuid/f4bf5b26-3959-4087-ad60-b5eaaf9c7cd5"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/f4bf5b26-3959-4087-ad60-b5eaaf9c7cd5"; + fsType = "ext4"; + }; - boot.initrd.luks.devices."luks-28e5a617-073a-4385-9fc2-f0620a8ead08".device = "/dev/disk/by-uuid/28e5a617-073a-4385-9fc2-f0620a8ead08"; + boot.initrd.luks.devices."luks-28e5a617-073a-4385-9fc2-f0620a8ead08".device = + "/dev/disk/by-uuid/28e5a617-073a-4385-9fc2-f0620a8ead08"; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/40B6-4877"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/40B6-4877"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; - fileSystems."/mnt/share" = - { device = "/dev/disk/by-uuid/0D608CA53E06CE7A"; - fsType = "ntfs-3g"; - options = [ "rw" "uid=1000" "gid=100" "umask=022" ]; - }; + fileSystems."/mnt/share" = { + device = "/dev/disk/by-uuid/0D608CA53E06CE7A"; + fsType = "ntfs-3g"; + options = [ "rw" "uid=1000" "gid=100" "umask=022" ]; + }; - swapDevices = [ ]; + swapDevices = [{ device = "/dev/disk/by-label/nix-swap"; }]; + boot.resumeDevice = "/dev/disk/by-label/nix-swap"; # 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 @@ -51,5 +52,6 @@ services.udev.packages = [ pkgs.rtl-sdr ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/pkgs/util.nix b/pkgs/util.nix index d817684..1d53795 100644 --- a/pkgs/util.nix +++ b/pkgs/util.nix @@ -75,4 +75,5 @@ with pkgs; [ cachix hyprpolkitagent mako + parted ]