nixos/xss-lock: improve module

* Don't use `literalExample`, raw Nix values can directly be specified
  as an option example which provides support for highlighting in the
  manual as well.

* Escape shell args for `extraOptions`: I.e. the `-n` option might be
  problematic as a longer notification command might be misinterpreted.
This commit is contained in:
Maximilian Bosch 2019-05-12 03:20:44 +02:00
parent 7fef2e38ea
commit 775146165d
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -18,7 +18,7 @@ in
extraOptions = mkOption {
default = [ ];
example = literalExample [ "--ignore-sleep" ];
example = [ "--ignore-sleep" ];
type = types.listOf types.str;
description = ''
Additional command-line arguments to pass to
@ -35,7 +35,7 @@ in
serviceConfig.ExecStart = with lib;
strings.concatStringsSep " " ([
"${pkgs.xss-lock}/bin/xss-lock"
] ++ cfg.extraOptions ++ [
] ++ (map escapeShellArg cfg.extraOptions) ++ [
"--"
cfg.lockerCommand
]);