nixos-config/system/desktop/suspend.nix

28 lines
633 B
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ pkgs, config, ... }:
{
systemd.services.screenlock = {
before = [ "sleep.target" ];
requiredBy = [ "sleep.target" ];
2019-12-20 05:54:26 +01:00
environment = let
display = if (config.services.xserver.display != null) then
config.services.xserver.display
else
0;
in { DISPLAY = ":${toString display}"; };
2019-10-24 02:20:38 +02:00
script = ''
${pkgs.xlockmore}/bin/xlock -mode life1d -size 1 &
2020-01-16 12:20:23 +01:00
sleep 1
2019-10-24 02:20:38 +02:00
'';
serviceConfig = {
SyslogIdentifier = "screenlock";
2020-01-16 12:20:23 +01:00
#Type = "simple";
2019-10-24 02:20:38 +02:00
Type = "forking";
User = config.users.users.mainUser.name;
};
};
2020-01-16 12:20:23 +01:00
services.logind.lidSwitch = "ignore";
2019-10-24 02:20:38 +02:00
}