stockholm/lass/3modules/screenlock.nix

38 lines
761 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;
default = "${pkgs.i3lock}/bin/i3lock -i /var/lib/wallpaper/wallpaper -f";
};
};
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;
Type = "forking";
User = "lass";
};
};
};
in out