]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/screen-locker.nix
xsecurelock: add more defaults
[julm/julm-nix.git] / home-manager / profiles / screen-locker.nix
1 { pkgs, lib, config, ... }:
2 with lib;
3 {
4 options.services.xsecurelock = {
5 settings = mkOption {
6 description = "xsecurelock settings";
7 type = lib.types.submodule {
8 freeformType = with types; attrsOf str;
9 };
10 default = {};
11 };
12 };
13 config = {
14 services.xsecurelock.settings = {
15 #XSECURELOCK_DATETIME_FORMAT = mkDefault "";
16 #XSECURELOCK_KEY_%s_COMMAND = mkDefault "";
17 #XSECURELOCK_SWITCH_USER_COMMAND = mkDefault "${pkgs.lightdm}/bin/dm-tool switch-to-greeter";
18 XSECURELOCK_BLANK_DPMS_STATE = mkDefault "off";
19 XSECURELOCK_BLANK_TIMEOUT = mkDefault "1";
20 XSECURELOCK_BURNIN_MITIGATION = mkDefault "100";
21 XSECURELOCK_BURNIN_MITIGATION_DYNAMIC = mkDefault "1";
22 XSECURELOCK_DIM_TIME_MS = mkDefault "2000";
23 XSECURELOCK_DISCARD_FIRST_KEYPRESS = mkDefault "0";
24 XSECURELOCK_FONT = mkDefault "monospace:size=12";
25 XSECURELOCK_PASSWORD_PROMPT = mkDefault "cursor";
26 XSECURELOCK_SAVER = mkDefault "saver_blank";
27 XSECURELOCK_SHOW_DATETIME = mkDefault "1";
28 XSECURELOCK_SHOW_HOSTNAME = mkDefault "1";
29 XSECURELOCK_SHOW_USERNAME = mkDefault "1";
30 XSECURELOCK_WAIT_TIME_MS = mkDefault "2000";
31 };
32 home.packages = [
33 pkgs.xsecurelock
34 pkgs.xss-lock
35 ];
36 services.screen-locker = {
37 enable = true;
38 lockCmd = toString (pkgs.writeShellScript "xsecurelock" ''
39 export PATH=${with pkgs; makeBinPath [coreutils gnugrep xsecurelock xorg.xset]}
40 ${concatMapStringsSep "\n"
41 ({name, value}: "export "+escapeShellArg name+"="+escapeShellArg value)
42 (attrsToList config.services.xsecurelock.settings)}
43 ${pkgs.xsecurelock}/bin/xsecurelock
44 '');
45 inactiveInterval = mkDefault 3; # minutes
46 xautolock.detectSleep = true;
47 xss-lock.extraOptions = [
48 "--transfer-sleep-lock"
49 #"-n" "${pkgs.xss-lock}/share/doc/xss-lock/dim-screen.sh"
50 ];
51 };
52 };
53 }