2020-04-24 23:36:52 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.xss-lock;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.xss-lock = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "xss-lock";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
lockerCommand = mkOption {
|
|
|
|
default = "${pkgs.i3lock}/bin/i3lock";
|
2021-10-06 13:57:05 +00:00
|
|
|
defaultText = literalExpression ''"''${pkgs.i3lock}/bin/i3lock"'';
|
|
|
|
example = literalExpression ''"''${pkgs.i3lock-fancy}/bin/i3lock-fancy"'';
|
2020-04-24 23:36:52 +00:00
|
|
|
type = types.separatedString " ";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = "Locker to be used with xsslock";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extraOptions = mkOption {
|
|
|
|
default = [ ];
|
|
|
|
example = [ "--ignore-sleep" ];
|
|
|
|
type = types.listOf types.str;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Additional command-line arguments to pass to
|
2022-08-12 12:06:08 +00:00
|
|
|
{command}`xss-lock`.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.user.services.xss-lock = {
|
|
|
|
description = "XSS Lock Daemon";
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
|
|
|
serviceConfig.ExecStart = with lib;
|
|
|
|
strings.concatStringsSep " " ([
|
2020-09-25 04:45:31 +00:00
|
|
|
"${pkgs.xss-lock}/bin/xss-lock" "--session \${XDG_SESSION_ID}"
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ (map escapeShellArg cfg.extraOptions) ++ [
|
|
|
|
"--"
|
|
|
|
cfg.lockerCommand
|
|
|
|
]);
|
2024-04-21 15:54:59 +00:00
|
|
|
serviceConfig.Restart = "always";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|