From 6229ab33d555f5a7e4e1e7b3dd7d45d095485a8e Mon Sep 17 00:00:00 2001 From: chn Date: Tue, 20 Jun 2023 00:12:22 +0800 Subject: [PATCH] reset iwlwifi after restore from hibernate put salt in separate partition --- modules/filesystem/chn-PC.nix | 4 +++- modules/hardware/chn-PC.nix | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/filesystem/chn-PC.nix b/modules/filesystem/chn-PC.nix index fe2f314b..f46fbf01 100644 --- a/modules/filesystem/chn-PC.nix +++ b/modules/filesystem/chn-PC.nix @@ -52,6 +52,8 @@ # mkdir -p /boot/crypt-storage # echo -ne "$SALT\n$ITERATIONS" > /boot/crypt-storage/default # echo -n "$LUKS_KEY" | hextorb | cryptsetup open /dev/sdb5 encrypted --key-file=- + # cryptsetup luksOpen --test-passphrase --key-slot 0 /dev/sda2 + # cryptsetup luksKillSlot /dev/sdb1 2 yubikeySupport = true; devices.root = { @@ -66,7 +68,7 @@ saltLength = 16; storage = { - device = "/dev/disk/by-uuid/02e426ec-cfa2-4a18-b3a5-57ef04d66614"; + device = "/dev/disk/by-uuid/631e5af2-af11-464a-9fbc-52f5215ae401"; fsType = "btrfs"; path = "/crypt-storage/default"; }; diff --git a/modules/hardware/chn-PC.nix b/modules/hardware/chn-PC.nix index 92de46ab..9ce1285d 100644 --- a/modules/hardware/chn-PC.nix +++ b/modules/hardware/chn-PC.nix @@ -1,3 +1,4 @@ +{ pkgs, ... }@inputs: { config = { @@ -5,5 +6,21 @@ services.dbus.implementation = "broker"; programs.dconf.enable = true; hardware.opengl.enable = true; + systemd.services.reload-iwlwifi-after-hibernate = + { + description = "reload iwlwifi after resume from hibernate"; + after = [ "systemd-hibernate.service" ]; + serviceConfig = + { + Type = "oneshot"; + ExecStart = + [ + "${pkgs.kmod}/bin/modprobe -r iwlmvm iwlwifi" + "${pkgs.kmod}/bin/modprobe iwlwifi" + "echo 0 | tee /sys/devices/system/cpu/intel_pstate/no_turbo" + ]; + }; + wantedBy = [ "systemd-hibernate.service" ]; + }; }; }