commit 35b880d7bc3c697c79a0e811887b9c7dd5162b8a
parent 27609b4e1e5ef325e39266ac2b400d5f7c271bed
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 10 Oct 2021 20:11:36 +0200
parent 27609b4e1e5ef325e39266ac2b400d5f7c271bed
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 10 Oct 2021 20:11:36 +0200
programs/systemd-lock-handler: add
1 file changed, 55 insertions(+), 0 deletions(-)
A
|
55
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/configurations/programs/systemd-lock-handler.nix b/configurations/programs/systemd-lock-handler.nix @@ -0,0 +1,55 @@ +{ config, pkgs, ... }: + +let + systemd-lock-handler = pkgs.buildGoModule rec { + name = "systemd-lock-handler"; + src = pkgs.fetchFromSourcehut { + owner = "~whynothugo"; + repo = "systemd-lock-handler"; + rev = "a0b3cec818520f2970b7da36b2cf25d860d8d017"; + sha256 = "1cna5kpcm9sb7azyk3355g5lb6vs8fyszkwjalv2ld159n80w63f"; + }; + vendorSha256 = "09n8g7m8pk442jgji7ws8mwp92c3ig8nvbbkbghh2pcgbgkyc3gn"; + }; + +in { + home-manager.users.leah.systemd.user = { + services.systemd-lock-handler = { + Unit = { + Description = "Logind lock event to systemd target translation"; + Documentation = [ "https://sr.ht/~whynothugo/systemd-lock-handler" ]; + }; + + Service = { + Type = "notify"; + ExecStart = "${systemd-lock-handler}/bin/systemd-lock-handler"; + }; + + Install = { + WantedBy = [ "default.target" ]; + }; + }; + + targets = { + lock = { + Unit = { + Description = "Lock the current session"; + Conflicts = [ "unlock.target" ]; + }; + }; + + unlock = { + Unit = { + Description = "Unlock the current session"; + Conflicts = [ "lock.target" ]; + }; + }; + + sleep = { + Unit = { + Description = "User-level target triggered when the system is about to sleep"; + }; + }; + }; + }; +}