From 9260c068ab421aeb94916b53ee4d26243f54172b Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Fri, 21 Oct 2022 14:16:06 +0200 Subject: [PATCH] Some prep for suspend and swap --- kagami-air-m1/configuration.nix | 15 +++++++++++++++ kagami-air-m1/hardware-configuration.nix | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/kagami-air-m1/configuration.nix b/kagami-air-m1/configuration.nix index f6e15e7..8920ae3 100644 --- a/kagami-air-m1/configuration.nix +++ b/kagami-air-m1/configuration.nix @@ -202,6 +202,21 @@ services.dbus.packages = with pkgs; [ gcr ]; + # Power Management + powerManagement = { + enable = true; + powerDownCommands = '' + /run/current-system/sw/bin/rmmod brcmfmac # Disable wifi + /run/current-system/sw/bin/rmmod hci_bcm4377 # Disable bluetooth + ''; + resumeCommands = '' + /run/current-system/sw/bin/modprobe brcmfmac # Enable wifi + /run/current-system/sw/bin/modprobe hci_bcm4377 # Enable bluetooth + /run/current-system/sw/bin/systemctl restart iwd + /run/current-system/sw/bin/systemctl restart bluetooth + ''; + }; + # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; diff --git a/kagami-air-m1/hardware-configuration.nix b/kagami-air-m1/hardware-configuration.nix index 615b861..3739792 100644 --- a/kagami-air-m1/hardware-configuration.nix +++ b/kagami-air-m1/hardware-configuration.nix @@ -26,7 +26,9 @@ fsType = "vfat"; }; - swapDevices = [ ]; + swapDevices = [ + { device = "/swap"; size = 16 * 1024; } + ]; # 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