2018-05-18 16:24:53 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.xss-lock;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.xss-lock = {
|
2022-08-28 19:18:44 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "xss-lock");
|
2019-05-11 16:56:48 +00:00
|
|
|
|
2018-05-18 16:24:53 +00:00
|
|
|
lockerCommand = mkOption {
|
2019-01-04 14:41:51 +00:00
|
|
|
default = "${pkgs.i3lock}/bin/i3lock";
|
2021-10-03 16:06:03 +00:00
|
|
|
defaultText = literalExpression ''"''${pkgs.i3lock}/bin/i3lock"'';
|
|
|
|
example = literalExpression ''"''${pkgs.i3lock-fancy}/bin/i3lock-fancy"'';
|
2019-08-08 20:48:27 +00:00
|
|
|
type = types.separatedString " ";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc "Locker to be used with xsslock";
|
2018-05-18 16:24:53 +00:00
|
|
|
};
|
2019-05-11 16:56:48 +00:00
|
|
|
|
|
|
|
extraOptions = mkOption {
|
|
|
|
default = [ ];
|
2019-05-12 01:20:44 +00:00
|
|
|
example = [ "--ignore-sleep" ];
|
2019-05-11 16:56:48 +00:00
|
|
|
type = types.listOf types.str;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2019-05-11 16:56:48 +00:00
|
|
|
Additional command-line arguments to pass to
|
2022-07-28 21:19:15 +00:00
|
|
|
{command}`xss-lock`.
|
2019-05-11 16:56:48 +00:00
|
|
|
'';
|
|
|
|
};
|
2018-05-18 16:24:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.user.services.xss-lock = {
|
|
|
|
description = "XSS Lock Daemon";
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
partOf = [ "graphical-session.target" ];
|
2019-05-11 16:56:48 +00:00
|
|
|
serviceConfig.ExecStart = with lib;
|
|
|
|
strings.concatStringsSep " " ([
|
2020-07-24 11:41:24 +00:00
|
|
|
"${pkgs.xss-lock}/bin/xss-lock" "--session \${XDG_SESSION_ID}"
|
2019-05-12 01:20:44 +00:00
|
|
|
] ++ (map escapeShellArg cfg.extraOptions) ++ [
|
2019-05-11 16:56:48 +00:00
|
|
|
"--"
|
|
|
|
cfg.lockerCommand
|
|
|
|
]);
|
2018-05-18 16:24:53 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|