1 { config, pkgs, lib, ... }:
4 cfg = config.programs.xss-lock;
7 options.programs.xss-lock = {
8 enable = lib.mkEnableOption "xss-lock";
10 lockerCommand = lib.mkOption {
11 default = "${pkgs.i3lock}/bin/i3lock";
12 defaultText = lib.literalExpression ''"''${pkgs.i3lock}/bin/i3lock"'';
13 example = lib.literalExpression ''"''${pkgs.i3lock-fancy}/bin/i3lock-fancy"'';
14 type = lib.types.separatedString " ";
15 description = "Locker to be used with xsslock";
18 extraOptions = lib.mkOption {
20 example = [ "--ignore-sleep" ];
21 type = lib.types.listOf lib.types.str;
23 Additional command-line arguments to pass to
29 config = lib.mkIf cfg.enable {
30 systemd.user.services.xss-lock = {
31 description = "XSS Lock Daemon";
32 wantedBy = [ "graphical-session.target" ];
33 partOf = [ "graphical-session.target" ];
34 serviceConfig.ExecStart =
35 builtins.concatStringsSep " " ([
36 "${pkgs.xss-lock}/bin/xss-lock" "--session \${XDG_SESSION_ID}"
37 ] ++ (builtins.map lib.escapeShellArg cfg.extraOptions) ++ [
41 serviceConfig.Restart = "always";
44 warnings = lib.mkIf (config.services.xserver.displayManager.startx.enable) [
45 "xss-lock service only works if a displayManager is set; it doesn't work when services.xserver.displayManager.startx.enable = true"