]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/screen-locker.nix
essentials: add mmc-utils
[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_BLANK_DPMS_STATE = mkDefault "off";
16 XSECURELOCK_BLANK_TIMEOUT = mkDefault "1";
17 XSECURELOCK_DIM_TIME_MS = mkDefault "2000";
18 XSECURELOCK_DISCARD_FIRST_KEYPRESS = mkDefault "0";
19 XSECURELOCK_FONT = mkDefault "monospace:size=12";
20 XSECURELOCK_SAVER = mkDefault "saver_blank";
21 XSECURELOCK_SHOW_DATETIME = mkDefault "1";
22 XSECURELOCK_SHOW_HOSTNAME = mkDefault "1";
23 XSECURELOCK_SHOW_USERNAME = mkDefault "1";
24 #XSECURELOCK_SWITCH_USER_COMMAND = mkDefault "${pkgs.lightdm}/bin/dm-tool switch-to-greeter";
25 XSECURELOCK_WAIT_TIME_MS = mkDefault "2000";
26 };
27 home.packages = [
28 pkgs.xsecurelock
29 pkgs.xss-lock
30 ];
31 services.screen-locker = {
32 enable = true;
33 lockCmd = toString (pkgs.writeShellScript "xsecurelock" ''
34 export PATH=${with pkgs; makeBinPath [coreutils gnugrep xsecurelock xorg.xset]}
35 ${concatMapStringsSep "\n"
36 ({name, value}: "export "+escapeShellArg name+"="+escapeShellArg value)
37 (attrsToList config.services.xsecurelock.settings)}
38 ${pkgs.xsecurelock}/bin/xsecurelock
39 '');
40 inactiveInterval = mkDefault 3; # minutes
41 xautolock.detectSleep = true;
42 xss-lock.extraOptions = [
43 "--transfer-sleep-lock"
44 #"-n" "${pkgs.xss-lock}/share/doc/xss-lock/dim-screen.sh"
45 ];
46 };
47 };
48 }