2017-10-19 16:42:09 +00:00
|
|
|
{ pkgs, config, ... }:
|
|
|
|
|
|
|
|
with import <stockholm/lib>;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.lass.screenlock;
|
|
|
|
|
|
|
|
out = {
|
|
|
|
options.lass.screenlock = api;
|
|
|
|
config = mkIf cfg.enable imp;
|
|
|
|
};
|
|
|
|
|
|
|
|
api = {
|
2017-10-26 17:13:02 +00:00
|
|
|
enable = mkEnableOption "screenlock";
|
2017-10-19 16:42:09 +00:00
|
|
|
command = mkOption {
|
2019-04-07 17:31:44 +00:00
|
|
|
type = types.path;
|
|
|
|
default = pkgs.writeDash "screenlock" ''
|
|
|
|
${pkgs.xlockmore}/bin/xlock -mode life1d -size 1
|
|
|
|
sleep 3
|
|
|
|
'';
|
2017-10-19 16:42:09 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
imp = {
|
|
|
|
systemd.services.screenlock = {
|
|
|
|
before = [ "sleep.target" ];
|
2019-04-07 17:31:44 +00:00
|
|
|
requiredBy = [ "sleep.target" ];
|
2017-10-19 16:42:09 +00:00
|
|
|
environment = {
|
2017-12-03 22:13:54 +00:00
|
|
|
DISPLAY = ":${toString config.services.xserver.display}";
|
2017-10-19 16:42:09 +00:00
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
SyslogIdentifier = "screenlock";
|
|
|
|
ExecStart = cfg.command;
|
2018-03-18 21:03:25 +00:00
|
|
|
Type = "simple";
|
2017-10-19 16:42:09 +00:00
|
|
|
User = "lass";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in out
|