From 568d3f8d894c2dc56731d70019684c86a40ec1d9 Mon Sep 17 00:00:00 2001 From: clerie Date: Mon, 8 Jan 2024 15:44:28 +0100 Subject: [PATCH] hosts/krypton: Turn on keyboard backlight and display battery levels at cryptsetup askpass --- hosts/krypton/configuration.nix | 1 + hosts/krypton/initrd.nix | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 hosts/krypton/initrd.nix diff --git a/hosts/krypton/configuration.nix b/hosts/krypton/configuration.nix index 53bdecf..9f703ad 100644 --- a/hosts/krypton/configuration.nix +++ b/hosts/krypton/configuration.nix @@ -8,6 +8,7 @@ ../../configuration/desktop ./backup.nix + ./initrd.nix ./network.nix ./programs.nix ]; diff --git a/hosts/krypton/initrd.nix b/hosts/krypton/initrd.nix new file mode 100644 index 0000000..62a89f2 --- /dev/null +++ b/hosts/krypton/initrd.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + + boot.initrd.kernelModules = [ "thinkpad_acpi" ]; + + boot.initrd.preLVMCommands = '' + # Turn on keyboard backlight before asking for drive encryption password + echo 1 > /sys/class/leds/tpacpi::kbd_backlight/brightness + + # Show battery levels + echo + echo "Battery level: External $(cat /sys/class/power_supply/BAT1/capacity)% Internal $(cat /sys/class/power_supply/BAT0/capacity)%" + echo + ''; + +}