This repository has no description
811 B
37 lines
1{ pkgs, lib, config, ... }:
2let
3 cfg = config.lass.screenlock;
4
5 out = {
6 options.lass.screenlock = api;
7 config = lib.mkIf cfg.enable imp;
8 };
9
10 api = {
11 enable = lib.mkEnableOption "screenlock";
12 command = lib.mkOption {
13 type = lib.types.path;
14 default = pkgs.writers.writeDash "screenlock" ''
15 ${pkgs.xlockmore}/bin/xlock -mode life1d -size 1
16 sleep 3
17 '';
18 };
19 };
20
21 imp = {
22 systemd.services.screenlock = {
23 before = [ "sleep.target" ];
24 requiredBy = [ "sleep.target" ];
25 environment = {
26 DISPLAY = ":${toString config.services.xserver.display}";
27 };
28 serviceConfig = {
29 SyslogIdentifier = "screenlock";
30 ExecStart = cfg.command;
31 Type = "simple";
32 User = "lass";
33 };
34 };
35 };
36
37in out