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 &
|
|
|
|
sleep 4
|
|
|
|
'';
|
|
|
|
serviceConfig = {
|
|
|
|
SyslogIdentifier = "screenlock";
|
|
|
|
# Type = "simple";
|
|
|
|
Type = "forking";
|
|
|
|
User = config.users.users.mainUser.name;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.logind.lidSwitch = "suspend";
|
|
|
|
|
|
|
|
}
|