From 74901b9bf2ea8372f2016f91a79247b3a8ffabb0 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sat, 16 Sep 2023 17:23:06 +0200 Subject: [PATCH] lid switch handling --- hosts/yodaTab/configuration.nix | 1 + hosts/yodaTux/configuration.nix | 1 + hosts/yodaYoga/configuration.nix | 1 + modules/lid-switch-handling.nix | 10 ++++++++++ modules/yodaYoga.nix | 3 --- 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 modules/lid-switch-handling.nix diff --git a/hosts/yodaTab/configuration.nix b/hosts/yodaTab/configuration.nix index c81eb9e..7a2e97e 100644 --- a/hosts/yodaTab/configuration.nix +++ b/hosts/yodaTab/configuration.nix @@ -47,6 +47,7 @@ in #../../modules/android.nix #../../modules/podman.nix #../../modules/docker.nix + ../../modules/lid-switch-handling.nix ]; networking.hostName = "yodaTab"; diff --git a/hosts/yodaTux/configuration.nix b/hosts/yodaTux/configuration.nix index 423139d..2474001 100644 --- a/hosts/yodaTux/configuration.nix +++ b/hosts/yodaTux/configuration.nix @@ -47,6 +47,7 @@ in ../../modules/android.nix #../../modules/podman.nix ../../modules/docker.nix + ../../modules/lid-switch-handling.nix ]; networking.hostName = "yodaTux"; diff --git a/hosts/yodaYoga/configuration.nix b/hosts/yodaYoga/configuration.nix index 28ab0a4..ebe8cdd 100644 --- a/hosts/yodaYoga/configuration.nix +++ b/hosts/yodaYoga/configuration.nix @@ -49,6 +49,7 @@ in #../../modules/android.nix #../../modules/podman.nix ../../modules/docker.nix + ../../modules/lid-switch-handling.nix ]; networking.hostName = "yodaYoga"; diff --git a/modules/lid-switch-handling.nix b/modules/lid-switch-handling.nix new file mode 100644 index 0000000..bd02d57 --- /dev/null +++ b/modules/lid-switch-handling.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + # Don't suspend if laptop lid is closed while plugged in. + # https://unix.stackexchange.com/a/307498 + # + # services.logind.lidSwitch = "suspend"; + services.logind.lidSwitchExternalPower = "ignore"; + #services.logind.lidSwitchDocked = "ignore"; +} diff --git a/modules/yodaYoga.nix b/modules/yodaYoga.nix index bf59686..b9052e2 100644 --- a/modules/yodaYoga.nix +++ b/modules/yodaYoga.nix @@ -1,9 +1,6 @@ { config, pkgs, ... }: { - services.logind.lidSwitch = "ignore"; - #services.logind.lidSwitchDocked = "ignore"; - users.users.yoda = { packages = with pkgs; [ git