stockholm/lass/3modules/screenlock.nix

38 lines
748 B
Nix
Raw Normal View History

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 {
type = types.str;
2018-03-18 21:03:25 +00:00
default = "${pkgs.xlockmore}/bin/xlock -mode life1d -size 1";
2017-10-19 16:42:09 +00:00
};
};
imp = {
systemd.services.screenlock = {
before = [ "sleep.target" ];
wantedBy = [ "sleep.target" ];
environment = {
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